mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-21 16:01:05 +00:00
Remove provider-level tool validation, add validateToolCall helper
This commit is contained in:
parent
0196308266
commit
8bec289dc6
14 changed files with 59 additions and 68 deletions
|
|
@ -27,7 +27,7 @@ import type {
|
|||
import { AssistantMessageEventStream } from "../utils/event-stream.js";
|
||||
import { parseStreamingJson } from "../utils/json-parse.js";
|
||||
import { sanitizeSurrogates } from "../utils/sanitize-unicode.js";
|
||||
import { validateToolArguments } from "../utils/validation.js";
|
||||
|
||||
import { transformMessages } from "./transorm-messages.js";
|
||||
|
||||
// OpenAI Responses-specific options
|
||||
|
|
@ -45,7 +45,6 @@ export const streamOpenAIResponses: StreamFunction<"openai-responses"> = (
|
|||
options?: OpenAIResponsesOptions,
|
||||
): AssistantMessageEventStream => {
|
||||
const stream = new AssistantMessageEventStream();
|
||||
const shouldValidateToolCalls = options?.validateToolCallsAtProvider !== false;
|
||||
|
||||
// Start async processing
|
||||
(async () => {
|
||||
|
|
@ -240,14 +239,6 @@ export const streamOpenAIResponses: StreamFunction<"openai-responses"> = (
|
|||
arguments: JSON.parse(item.arguments),
|
||||
};
|
||||
|
||||
// Validate tool arguments if tool definition is available
|
||||
if (shouldValidateToolCalls && context.tools) {
|
||||
const tool = context.tools.find((t) => t.name === toolCall.name);
|
||||
if (tool) {
|
||||
toolCall.arguments = validateToolArguments(tool, toolCall);
|
||||
}
|
||||
}
|
||||
|
||||
stream.push({ type: "toolcall_end", contentIndex: blockIndex(), toolCall, partial: output });
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue