feat(server): wire EmbeddingRelevanceScorer into context builder, default level 4

Move embedder construction ahead of the engines so the context pack builder ranks
freeform turns by query relevance (query-conditioned selection). Default
compression_level 4 (format + static cache + token pruning + age-tiering) for a 12b
on a 16k window.
This commit is contained in:
2026-07-01 14:33:00 +04:00
parent 047e2a4070
commit e3743835ec
3 changed files with 9 additions and 4 deletions
@@ -18,6 +18,7 @@ import com.correx.core.config.ProfileLoader
import com.correx.core.config.ProviderConfig
import com.correx.core.context.builder.DefaultContextPackBuilder
import com.correx.core.context.compression.CompressionPolicy
import com.correx.core.inference.EmbeddingRelevanceScorer
import com.correx.infrastructure.compression.HttpTokenPruner
import com.correx.core.context.compression.DefaultContextCompressor
import com.correx.core.context.model.TokenBudget
@@ -291,12 +292,16 @@ fun main() {
WorkspaceTools(registry = wsRegistry, executor = wsExecutor)
}
// Constructed before the engines so the context builder can rank freeform turns by relevance
// to the current query (pipeline §6, query-conditioned selection). Reused by L3 retrieval below.
val embedder = InfrastructureModule.createEmbedderFromConfig(correxConfig.router.embedder)
val engines = OrchestratorEngines(
transitionResolver = DefaultTransitionResolver { condition, ctx -> condition.evaluate(ctx) },
contextPackBuilder = DefaultContextPackBuilder(
DefaultContextCompressor(),
policy = CompressionPolicy(correxConfig.orchestration.compressionLevel),
tokenPruner = HttpTokenPruner(baseUrl = correxConfig.orchestration.tokenPrunerUrl),
relevanceScorer = EmbeddingRelevanceScorer(embedder),
),
inferenceRouter = inferenceRouter,
validationPipeline = ValidationPipeline(
@@ -340,7 +345,6 @@ fun main() {
val artifactKindRegistry = DefaultArtifactKindRegistry().also { reg ->
configArtifactKindsEarly.forEach { reg.register(it) }
}
val embedder = InfrastructureModule.createEmbedderFromConfig(correxConfig.router.embedder)
val l3MemoryStore = InfrastructureModule.createL3MemoryStoreFromConfig(correxConfig.router.l3)
// Rebuild the L3 metadata map from the ChatTurnEvent log before serving queries:
// persisted vectors survive restart but the metadata map does not (no-op for