fix: match other fix

This commit is contained in:
Nate 2025-08-21 08:50:09 -07:00
parent e99d472339
commit 7193dc9927

View file

@ -102,7 +102,7 @@ export function toChatBody(
if (options.tools?.length) {
params.tools = options.tools
.filter((tool) => tool.type === "function")
.filter((tool) => !tool.type || tool.type === "function")
.map((tool) => ({
type: tool.type,
function: {
@ -161,7 +161,7 @@ export function fromChatResponse(response: ChatCompletion): ChatMessage {
role: "assistant",
content: "",
toolCalls: message.tool_calls
?.filter((tc) => tc.type === "function")
?.filter((tc) => !tc.type || tc.type === "function")
.map((tc) => ({
id: tc.id,
type: "function" as const,