refactor(providers): share anthropic tool payload helper

This commit is contained in:
Vincent Koc
2026-04-04 11:30:05 +09:00
parent 87885b948a
commit e273753d45
4 changed files with 20 additions and 11 deletions

View File

@@ -1,6 +1,6 @@
import type { StreamFn } from "@mariozechner/pi-agent-core";
import { streamSimple } from "@mariozechner/pi-ai";
import { createAnthropicToolPayloadCompatibilityWrapper } from "openclaw/plugin-sdk/provider-stream";
import { createOpenAIAnthropicToolPayloadCompatibilityWrapper } from "openclaw/plugin-sdk/provider-stream";
const TOOL_CALLS_SECTION_BEGIN = "<|tool_calls_section_begin|>";
const TOOL_CALLS_SECTION_END = "<|tool_calls_section_end|>";
@@ -183,9 +183,6 @@ export function createKimiToolCallMarkupWrapper(baseStreamFn: StreamFn | undefin
export function wrapKimiProviderStream(baseStreamFn: StreamFn | undefined): StreamFn {
return createKimiToolCallMarkupWrapper(
createAnthropicToolPayloadCompatibilityWrapper(baseStreamFn, {
toolSchemaMode: "openai-functions",
toolChoiceMode: "openai-string-modes",
}),
createOpenAIAnthropicToolPayloadCompatibilityWrapper(baseStreamFn),
);
}