修复openai compatible执行效果不好的问题
This commit is contained in:
1 parent
ac6b27bd02
commit
0342d4c4a4
2 files changed
+5
-10
No files matched your search
@@ -103,14 +103,8 @@ export class OpenAiHandler implements ApiHandler {
|
||||
reasoningEffort = (this.options.reasoningEffort as ChatCompletionReasoningEffort) || "medium"
|
||||
}
|
||||
|
||||
const isOfficialOpenAi =
|
||||
!this.options.openAiBaseUrl ||
|
||||
this.options.openAiBaseUrl.toLowerCase().includes("api.openai.com") ||
|
||||
this.options.openAiBaseUrl.toLowerCase().includes("azure.com") ||
|
||||
this.options.openAiBaseUrl.toLowerCase().includes("azure.us")
|
||||
|
||||
const effectiveTools = isOfficialOpenAi ? tools : undefined
|
||||
|
||||
// Tools are passed through directly - the system prompt variant selection
|
||||
// determines whether to use native tools or XML-based tools
|
||||
const stream = await client.chat.completions.create({
|
||||
model: modelId,
|
||||
messages: openAiMessages,
|
||||
@@ -119,7 +113,7 @@ export class OpenAiHandler implements ApiHandler {
|
||||
reasoning_effort: reasoningEffort,
|
||||
stream: true,
|
||||
stream_options: { include_usage: true },
|
||||
...getOpenAIToolParams(effectiveTools),
|
||||
...getOpenAIToolParams(tools),
|
||||
})
|
||||
|
||||
const toolCallProcessor = new ToolCallProcessor()
|
||||
|
||||
@@ -11,7 +11,8 @@ export function isNextGenModelProvider(providerInfo: ApiProviderInfo): boolean {
|
||||
"gemini",
|
||||
"vertex",
|
||||
"openrouter",
|
||||
"openai",
|
||||
// Note: "openai" is excluded to use XML-based tool parsing for better compatibility
|
||||
// with OpenAI-compatible providers. Use "openai-native" for native tool calling with official OpenAI.
|
||||
"minimax",
|
||||
"openai-native",
|
||||
"baseten",
|
||||
|
||||
Reference in new issue
Block a user