A recipe assistant needs to answer questions from a growing collection of family recipes. Retrieval-augmented generation (RAG) lets a language model use that external collection without retraining whenever a recipe is added: it retrieves relevant recipes, then supplies them with the question to the model for an answer. section 14.3
The workflow has two connected parts:
- Prepare the collection. Split each recipe into an ingredients chunk and an instructions chunk, retaining the recipe name with both. Embed the content and store its vectors in Weaviate. Airflow can automate ingestion and updates; existing versions are identified before replacement. section 14.5 section 14.10
- Retrieve context. Embed the user’s question with the same model used for the recipes, then search the vector database for relevant documents. Cosine similarity compares vector direction, emphasizing meaning rather than identical wording. section 14.10.1
- Generate an answer. Send the question and retrieved recipes to a language model so its response can draw on the collection. section 14.3
A recipe question
For “How can I make lasagna?”, the assistant searches the stored recipes before answering with ingredients and steps. If the requested recipe is absent, the chat assistant says it does not know that recipe. It can also suggest stored recipes from a list of ingredients or share recipes in another language. section 14.10.1 section 14.10.3
Figure 14.3 Simplified representation of a RAG workflow: (1) A user asks a question about a recipe. (2) Vector search retrieves (3) the most relevant recipes. (4) The question and retrieved recipes are combined and sent to an LLM, which (5) generates an answer based on the relevant context.
The diagram follows a question through vector search, retrieval, and generation with the retrieved recipes as context. section 14.3
Chunk size is an operational choice. One enormous chunk makes a source recipe hard to pinpoint; sentence-sized chunks can return many redundant matches from the same recipe. Keeping ingredients and instructions as separate chunks provides a practical middle ground while preserving a link to the original recipe. section 14.5































