Context Assembly
Also called Prompt Assembly
Stitching retrieved passages, instructions, and history into the final prompt the model sees.
Think of it like
Plating a dish: arranging the retrieved ingredients in the right order so the meal makes sense.
Example
The system slots the top 5 chunks, a system instruction, and the user question into a template, trimming to fit the context window.
How it actually works
After retrieval, something has to decide the order, formatting, and token budget of everything that goes into the prompt — passages, citations, instructions, and history. Order matters (models weight the start and end more), as do deduplication and clear source markers for citation. Poor assembly can waste the good passages retrieval worked hard to find.
For product teams
The final step that determines whether good retrieval actually turns into a good answer.
For engineers
Template + ordering + token-budgeting of retrieved chunks and instructions; position, dedup, and source tagging all matter.
Related
- Retrieval Pipeline — The last stage of the retrieval pipeline.
- Context window — Must respect the context window budget.
Read anything AI without the jargon
Look up any term in plain English, or save terms as you read with the free Chrome extension.
Open DecoderAdd to Chrome