From 64109d20121b56ff486da38115a0476fee180ef1 Mon Sep 17 00:00:00 2001 From: Arun2728 Date: Sun, 19 Apr 2026 22:18:53 +0530 Subject: [PATCH] fix(mistral-ai): forward response_format for JSON schema --- src/providers/mistral-ai/chatComplete.ts | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/providers/mistral-ai/chatComplete.ts b/src/providers/mistral-ai/chatComplete.ts index 0d28a34c2..f15798010 100644 --- a/src/providers/mistral-ai/chatComplete.ts +++ b/src/providers/mistral-ai/chatComplete.ts @@ -100,6 +100,30 @@ export const MistralAIChatCompleteConfig: ProviderConfig = { param: 'parallel_tool_calls', default: null, }, + response_format: { + param: 'response_format', + default: null, + transform: (params: Params) => { + const rf = params.response_format; + if (!rf) { + return null; + } + if (rf.type !== 'json_schema' || !rf.json_schema) { + return rf; + } + const inner = rf.json_schema; + if (inner.name) { + return rf; + } + return { + ...rf, + json_schema: { + ...inner, + name: 'response', + }, + }; + }, + }, }; interface MistralToolCallFunction {