feat(context,infra): compression pipeline stages 4-5 — token pruning + relevance + ToMe
- build() is now suspend: pipeline runs all stages in fixed order, each gated by level - TOKEN_PRUNE (level 3): TokenPruner interface + LLMLingua-2 sidecar (sidecars/llmlingua) + HttpTokenPruner adapter (fails open if sidecar down); prunes freeform, preserves protected spans, skips tier-0 turns when TIER_SPLIT on - TOME_MERGE (level 8): ToMeMerger collapses near-duplicate freeform turns (Jaccard) - Stage 5 selection: RelevanceScorer + EmbeddingRelevanceScorer (cosine over Embedder); query-conditioned reorder so least-relevant freeform drops first under budget - [orchestration] compression_level + token_pruner_url config, wired in Main - suspend ripple fixed across builder callers/stubs
This commit is contained in:
@@ -29,7 +29,7 @@ class PromptRendererOrderingTest {
|
||||
)
|
||||
|
||||
@Test
|
||||
fun `stage tool loop renders chronologically with the task before tool turns`() {
|
||||
fun `stage tool loop renders chronologically with the task before tool turns`() = kotlinx.coroutines.runBlocking {
|
||||
// The builder stamps ordinals from input order; the renderer must honour them so the
|
||||
// model sees: system, task, assistant call, tool result, assistant call, tool result.
|
||||
val builder = DefaultContextPackBuilder(DefaultContextCompressor())
|
||||
@@ -49,6 +49,7 @@ class PromptRendererOrderingTest {
|
||||
"tool" to "result1", "assistant" to "call2", "tool" to "result2"),
|
||||
messages.map { it.role to it.content },
|
||||
)
|
||||
Unit
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user