Learn hybrid search for RAG: combine BM25 keyword search and vector search with RRF, re-rank results with a cross-encoder and rewrite vague queries.
Continue reading...Series: Generative AI
Generative AI Part 12: Document Loading and Chunking Strategies for RAG
Learn document loading and chunking strategies for RAG: load PDF, HTML and Markdown in Python and Node.js, compare chunk size and overlap, and test the results.
Continue reading...Generative AI Part 11: RAG Fundamentals: Retrieval-Augmented Generation Explained
Learn RAG fundamentals: how retrieval-augmented generation works, how to write a RAG prompt with citations, and build a RAG app in Python and Node.js.
Continue reading...Generative AI Part 10: Vector Databases: pgvector, Chroma and Pinecone
Learn what a vector database is and how to store and search embeddings with Chroma, pgvector and Pinecone, using runnable Python, Node.js and SQL examples.
Continue reading...Generative AI Part 9: Embeddings Explained: Turning Text into Vectors
Learn what embeddings are, how cosine similarity works and how to build a semantic search with OpenAI and Ollama in Python and Node.js. Beginner friendly.
Continue reading...Generative AI Part 8: Structured Outputs for Reliable JSON from LLMs
Learn structured outputs for LLMs: get reliable JSON from OpenAI and Ollama using Pydantic and Zod schemas, plus validation and retry in Python and Node.js.
Continue reading...Generative AI Part 7: How to Stream LLM Responses and Build a Simple Chat UI
Learn how to stream LLM responses in Python and Node.js, read Server-Sent Events and build a simple chat UI with memory and a Stop button for Ollama or OpenAI.
Continue reading...Generative AI Part 6: How to Run LLMs Locally with Ollama
Learn to run LLMs locally with Ollama: install it, pull open models, chat in the terminal and call them from Python and Node.js. Free, private and offline.
Continue reading...Generative AI Part 5: Temperature and Top-p for Controlling Model Output
Learn temperature and top-p for LLMs: how sampling works, plus top-k, max tokens, stop sequences and which GPT-6 and Claude models accept them, with code.
Continue reading...Generative AI Part 4: Prompt Engineering Basics with Roles, Instructions and Examples
Learn prompt engineering basics: system and user roles, clear instructions, XML tags, few-shot examples and prompt templates, with Python and Node.js code.
Continue reading...