mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-05 08:20:23 +00:00
fix(agents): enable tool call ID sanitization for Anthropic provider (#13830)
Co-authored-by: 0xRaini <0xRaini@users.noreply.github.com>
This commit is contained in:
41
src/agents/transcript-policy.test.ts
Normal file
41
src/agents/transcript-policy.test.ts
Normal file
@@ -0,0 +1,41 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { resolveTranscriptPolicy } from "./transcript-policy.js";
|
||||
|
||||
describe("resolveTranscriptPolicy", () => {
|
||||
it("enables sanitizeToolCallIds for Anthropic provider", () => {
|
||||
const policy = resolveTranscriptPolicy({
|
||||
provider: "anthropic",
|
||||
modelId: "claude-opus-4-5",
|
||||
modelApi: "anthropic-messages",
|
||||
});
|
||||
expect(policy.sanitizeToolCallIds).toBe(true);
|
||||
expect(policy.toolCallIdMode).toBe("strict");
|
||||
});
|
||||
|
||||
it("enables sanitizeToolCallIds for Google provider", () => {
|
||||
const policy = resolveTranscriptPolicy({
|
||||
provider: "google",
|
||||
modelId: "gemini-2.0-flash",
|
||||
modelApi: "google-generative-ai",
|
||||
});
|
||||
expect(policy.sanitizeToolCallIds).toBe(true);
|
||||
});
|
||||
|
||||
it("enables sanitizeToolCallIds for Mistral provider", () => {
|
||||
const policy = resolveTranscriptPolicy({
|
||||
provider: "mistral",
|
||||
modelId: "mistral-large-latest",
|
||||
});
|
||||
expect(policy.sanitizeToolCallIds).toBe(true);
|
||||
expect(policy.toolCallIdMode).toBe("strict9");
|
||||
});
|
||||
|
||||
it("disables sanitizeToolCallIds for OpenAI provider", () => {
|
||||
const policy = resolveTranscriptPolicy({
|
||||
provider: "openai",
|
||||
modelId: "gpt-4o",
|
||||
modelApi: "openai",
|
||||
});
|
||||
expect(policy.sanitizeToolCallIds).toBe(false);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user