A retriever returns fifty passages. The model has room for maybe eight. Something has to choose, and getting it wrong is how a RAG system silently loses the answer it already found.
Implement pack_context(passages, budget):
passages is a list of (id, text, score), already ordered best firstlen(text.split()) tokensThe skip-rather-than-stop rule is the whole problem. Stopping at the first passage that does not fit means one 2,000-token document at rank 3 discards ranks 4 through 50, including the passage that actually answers the question.
Build the architecture on a canvas: place the components, configure them, connect them into a data flow, and write a short reason for each one. The AI reviewer grades your design against a rubric written specifically for this problem.
Minimum 5 components · needs a wide desktop screen