Skip to content

Commit 6832175

Browse files
committed
update
1 parent 425a05a commit 6832175

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

packages/lib/services/ai/providers/OpenAiCompatible.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,14 @@ export default class OpenAiCompatibleProvider extends ChatProviderBase {
171171
({ response, json } = await doFetch());
172172
}
173173

174+
// Reasoning models apply a reasoning_effort default server-side, which OpenAI then rejects
175+
// alongside tools on /chat/completions. Opt out of the default to keep tools working.
176+
if (response.status === 400 && 'tools' in body && /reasoning_effort/i.test(errorMessage())) {
177+
logger.warn(`Model ${this.model_} rejected function tools with reasoning; retrying with reasoning disabled.`);
178+
body.reasoning_effort = 'none';
179+
({ response, json } = await doFetch());
180+
}
181+
174182
// Older OpenAI models might reject `response_format` json_schema (see https://stackoverflow.com/q/79039544).
175183
// For compatibility, retry without response_format on failure:
176184
if (response.status === 400 && 'response_format' in body && /json_schema|response_format/i.test(errorMessage())) {

0 commit comments

Comments
 (0)