Skip to content

Commit 6ae088e

Browse files
committed
Fix edge cases with formatNative
1 parent ea3694d commit 6ae088e

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

packages/core/src/custom-tools/format-native.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,15 @@ import type { OpenAI } from "openai"
33
import type { SerializedCustomToolDefinition } from "@roo-code/types"
44

55
export function formatNative(tool: SerializedCustomToolDefinition): OpenAI.Chat.ChatCompletionFunctionTool {
6-
return { type: "function", function: tool }
6+
const { parameters } = tool
7+
8+
if (parameters) {
9+
delete parameters["$schema"]
10+
11+
if (!parameters.required) {
12+
parameters.required = []
13+
}
14+
}
15+
16+
return { type: "function", function: { ...tool, strict: true, parameters } }
717
}

0 commit comments

Comments
 (0)