fix(llm): delegate embed() to tier providers in TriageRouter (#2174)#2176
Merged
fix(llm): delegate embed() to tier providers in TriageRouter (#2174)#2176
Conversation
…geRouter When routing = "triage", TriageRouter wraps the provider pool but previously returned EmbeddingNotSupported from embed(), causing the tool schema filter to be silently disabled at startup. TriageRouter.embed() now delegates to the first tier provider that reports supports_embeddings() = true, then falls back to the triage provider, before returning EmbedUnsupported. supports_embeddings() reflects tier provider capability instead of hardcoding false. Adds four unit tests covering the new delegation behavior. Fixes #2174
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
TriageRouter.embed()now delegates to the first embedding-capable tier provider instead of always returningEmbeddingNotSupportedTriageRouter.supports_embeddings()now reflects whether any tier provider supports embeddings (was hardcodedfalse)[llm] routing = "triage"Root Cause
AgentBuilder::maybe_init_tool_schema_filtercallsprovider.embed()to build tool embeddings at startup. Withrouting = "triage",provideris aTriageRouterthat wraps the underlying provider pool but returnedEmbedUnsupportedunconditionally — even when a tier provider (e.g., thefastprovider withembedding_model = "text-embedding-3-small") fully supports embeddings.Fix
TriageRouter::embed()iteratestier_providersto find the first embedding-capable provider and delegates to it. Falls back totriage_providerif it supports embeddings. ReturnsEmbedUnsupportedonly when no provider in the router can embed.Test Plan
supports_embeddings_false_when_no_tier_supports_itsupports_embeddings_true_when_tier_supports_itembed_delegates_to_first_embedding_capable_tierembed_returns_error_when_no_tier_supports_embeddingscargo +nightly fmt --check— cleancargo clippy --workspace --features full -- -D warnings— cleancargo nextest run --workspace --features full --lib --bins— 6472/6472 passedCloses #2174