feat(rig-core): add optional model override to CompletionRequest (#1278)#1374
Merged
joshua-mo-143 merged 1 commit into0xPlaygrounds:mainfrom Feb 11, 2026
Conversation
Add an optional per-request model field to CompletionRequest so callers can override the default model selected in T: CompletionModel. - add CompletionRequest.model: Option<String> - add CompletionRequestBuilder::model(...) and model_opt(...) - propagate request-level model override through provider request conversions - update path-based providers (Gemini/HuggingFace/OpenRouter) to use effective model for endpoint routing - add override/fallback unit tests for OpenAI/OpenRouter/Gemini/HuggingFace - update struct literals in tests/builders to include model: None Fixes 0xPlaygrounds#1278
Contributor
Author
|
@joshua-mo-143 Can this please be reviewed 🙂 |
joshua-mo-143
approved these changes
Feb 11, 2026
Contributor
joshua-mo-143
left a comment
There was a problem hiding this comment.
lgtm I think? doesn't seem to break anything
Contributor
Author
|
@joshua-mo-143 I dont see the merge button, not sure why? |
Contributor
The merge button is strictly limited to maintainers and we use merge queue to manage merging multiple PRs at once, as otherwise it'll screw with the |
Contributor
Author
|
Okay got it. Thank you. Would love to continue contributing here, feel free to mention me in any issue you think. |
Merged
ThomasMarches
pushed a commit
to ThomasMarches/rig
that referenced
this pull request
Feb 13, 2026
…laygrounds#1374) Add an optional per-request model field to CompletionRequest so callers can override the default model selected in T: CompletionModel. - add CompletionRequest.model: Option<String> - add CompletionRequestBuilder::model(...) and model_opt(...) - propagate request-level model override through provider request conversions - update path-based providers (Gemini/HuggingFace/OpenRouter) to use effective model for endpoint routing - add override/fallback unit tests for OpenAI/OpenRouter/Gemini/HuggingFace - update struct literals in tests/builders to include model: None Fixes 0xPlaygrounds#1278
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
Implements #1278 by adding a request-scoped model override to
CompletionRequest, allowing callers to override the model selected inT: CompletionModel(needed for batch workflows).Fixes #1278
Problem
Today, model selection is fixed by the
CompletionModelinstance. Batch-style or mixed-model workflows need a way to override model per request.Implementation
model: Option<String>toCompletionRequest.CompletionRequestBuilder::model(...)CompletionRequestBuilder::model_opt(...)req.modelwhen providedmodel: Nonewhere needed.Tests
Validated with:
cargo check -p rig-corecargo test -p rig-core openai_request_uses_ -- --nocapturecargo test -p rig-core openrouter_request_uses_ -- --nocapturecargo test -p rig-core resolve_request_model_uses_ -- --nocapturecargo test -p rig-core huggingface_request_uses_ -- --nocaptureNew focused tests were added for override/fallback behavior in:
Public API breakage and migration path
Breaking
completion::CompletionRequestadded a new public field:model: Option<String>CompletionRequestnow requires this field.Migration
model: Nonemodel: Some("provider-model-id".to_string())completion_request(...).model("provider-model-id")Risk / remaining failure points
cargo testmay still include unrelated failures outside this change scope.