Skip to content

Commit db5b243

Browse files
imumesh18notpeter
authored andcommitted
language_models: Fix tool calling for x-ai/grok-code-fast-1 model via OpenRouter (#37094)
Closes #37022 Closes #36994 This update ensures all Grok models use the JsonSchemaSubset format for tool schemas. A previous fix for this issue was too specific, only targeting grok-4 models. This caused other variants, like grok-code-fast-1, to be missed. We've now broadened the logic to correctly apply the setting to the entire Grok model family. Release Notes: - Fix tool calling for `x-ai/grok-code-fast-1` model via OpenRouter.
1 parent 3988c10 commit db5b243

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

crates/language_models/src/provider/open_router.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,7 @@ impl LanguageModel for OpenRouterLanguageModel {
381381

382382
fn tool_input_format(&self) -> LanguageModelToolSchemaFormat {
383383
let model_id = self.model.id().trim().to_lowercase();
384-
if model_id.contains("gemini") || model_id.contains("grok-4") {
384+
if model_id.contains("gemini") || model_id.contains("grok") {
385385
LanguageModelToolSchemaFormat::JsonSchemaSubset
386386
} else {
387387
LanguageModelToolSchemaFormat::JsonSchema

0 commit comments

Comments
 (0)