workers-ai-provider
Advanced tools
Comparing version 0.1.0 to 0.1.1
@@ -175,3 +175,6 @@ var __defProp = Object.defineProperty; | ||
...baseArgs, | ||
response_format: { type: "json_object" }, | ||
response_format: { | ||
type: "json_schema", | ||
json_schema: mode.schema | ||
}, | ||
tools: void 0 | ||
@@ -214,3 +217,5 @@ }, | ||
tools: args.tools, | ||
top_p: args.top_p | ||
top_p: args.top_p, | ||
// @ts-expect-error response_format not yet added to types | ||
response_format: args.response_format | ||
}, | ||
@@ -223,3 +228,3 @@ { gateway: this.config.gateway ?? this.settings.gateway } | ||
return { | ||
text: output.response, | ||
text: typeof output.response === "object" && output.response !== null ? JSON.stringify(output.response) : output.response, | ||
toolCalls: output.tool_calls?.map((toolCall) => ({ | ||
@@ -226,0 +231,0 @@ toolCallType: "function", |
@@ -5,3 +5,3 @@ { | ||
"type": "module", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"main": "dist/index.js", | ||
@@ -8,0 +8,0 @@ "types": "dist/index.d.ts", |
@@ -101,3 +101,6 @@ import { | ||
...baseArgs, | ||
response_format: { type: "json_object" }, | ||
response_format: { | ||
type: "json_schema", | ||
json_schema: mode.schema, | ||
}, | ||
tools: undefined, | ||
@@ -148,2 +151,4 @@ }, | ||
top_p: args.top_p, | ||
// @ts-expect-error response_format not yet added to types | ||
response_format: args.response_format, | ||
}, | ||
@@ -158,3 +163,6 @@ { gateway: this.config.gateway ?? this.settings.gateway } | ||
return { | ||
text: output.response, | ||
text: | ||
typeof output.response === "object" && output.response !== null | ||
? JSON.stringify(output.response) // ai-sdk expects a string here | ||
: output.response, | ||
toolCalls: output.tool_calls?.map((toolCall) => ({ | ||
@@ -161,0 +169,0 @@ toolCallType: "function", |
Sorry, the diff of this file is not supported yet
50324
925