fix: inject fallback model name into CompletionRequest#202
Open
voidborne-d wants to merge 1 commit intoRightNow-AI:mainfrom
Open
fix: inject fallback model name into CompletionRequest#202voidborne-d wants to merge 1 commit intoRightNow-AI:mainfrom
voidborne-d wants to merge 1 commit intoRightNow-AI:mainfrom
Conversation
When FallbackDriver retries with a different provider, it now correctly overrides request.model with the fallback entry's model name instead of forwarding the primary model name unchanged. Fixes RightNow-AI#200
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.
Problem
When
FallbackDriverretries a request with a different provider,request.modelstill carries the primary model name. This causes the fallback provider to receive an invalid model ID (e.g., sendingclaude-3-opusto an OpenAI endpoint).Fixes #200
Root Cause
FallbackDrivercloned the request as-is for every driver in the chain. Themodelfield was never updated to match the fallback entry's configured model.Solution
FallbackEntrystruct that pairs each driver with an optional model overrideFallbackDriver::with_models()constructor acceptsVec<(Arc<dyn LlmDriver>, String)>complete()andstream()now inject the correct model before forwardingresolve_driver()to usewith_models()FallbackDriver::new()is preserved for backward compatibilitytest_with_models_overrides_model_on_fallbackverifying the overrideChanges
crates/openfang-runtime/src/drivers/fallback.rs— newFallbackEntry,with_models(), model injection incomplete()/stream()crates/openfang-kernel/src/kernel.rs— both fallback construction sites now pass model names