audit_and_pack_rag_context
Audit retrieved RAG passages against encoder token limits, re-chunk truncated text, remove near-duplicates, and order passages for attention within a strict context budget.
Instructions
Audit retrieved RAG passages against embedding encoder hard limits (MiniLM 256, BGE/E5 512, Nomic 2048, OpenAI 8191, Voyage 32k), eliminate silent truncation via sentence-bounded re-chunking, remove Jaccard near-duplicates, and apply Lost-in-the-Middle U-shaped attention ordering inside a strict token budget.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"chunks": "<chunks>"
},
"name": "audit_and_pack_rag_context"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| chunks | Yes | Candidate retrieved passages with text, optional id, source, and relevance score. | |
| encoderModel | No | Embedding encoder preset for truncation audit (default: all-minilm-l6-v2). | |
| overlapTokens | No | Sentence overlap tokens when re-chunking (default: 32). | |
| dedupThreshold | No | Jaccard near-duplicate threshold 0..1 (default: 0.72). | |
| encoderMaxTokens | No | Optional custom encoder token limit override. | |
| maxContextTokens | No | Hard token budget for final packed prompt context (default: 4000). | |
| reorderForAttention | No | Apply U-shaped Lost-in-the-Middle ordering (default: true). |