@ai-sdk/openai 2.0.0-alpha.13 → 2.0.0-alpha.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +10 -0
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +18 -18
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +18 -18
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.js +17 -17
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +17 -17
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/index.mjs
CHANGED
|
@@ -153,7 +153,7 @@ function convertToOpenAIChatMessages({
|
|
|
153
153
|
type: "function",
|
|
154
154
|
function: {
|
|
155
155
|
name: part.toolName,
|
|
156
|
-
arguments: JSON.stringify(part.
|
|
156
|
+
arguments: JSON.stringify(part.input)
|
|
157
157
|
}
|
|
158
158
|
});
|
|
159
159
|
break;
|
|
@@ -172,7 +172,7 @@ function convertToOpenAIChatMessages({
|
|
|
172
172
|
messages.push({
|
|
173
173
|
role: "tool",
|
|
174
174
|
tool_call_id: toolResponse.toolCallId,
|
|
175
|
-
content: JSON.stringify(toolResponse.
|
|
175
|
+
content: JSON.stringify(toolResponse.output)
|
|
176
176
|
});
|
|
177
177
|
}
|
|
178
178
|
break;
|
|
@@ -315,7 +315,7 @@ function prepareTools({
|
|
|
315
315
|
}
|
|
316
316
|
const openaiTools2 = [];
|
|
317
317
|
for (const tool of tools) {
|
|
318
|
-
if (tool.type === "provider-defined") {
|
|
318
|
+
if (tool.type === "provider-defined-client" || tool.type === "provider-defined-server") {
|
|
319
319
|
toolWarnings.push({ type: "unsupported-tool", tool });
|
|
320
320
|
} else {
|
|
321
321
|
openaiTools2.push({
|
|
@@ -323,7 +323,7 @@ function prepareTools({
|
|
|
323
323
|
function: {
|
|
324
324
|
name: tool.name,
|
|
325
325
|
description: tool.description,
|
|
326
|
-
parameters: tool.
|
|
326
|
+
parameters: tool.inputSchema,
|
|
327
327
|
strict: structuredOutputs ? true : void 0
|
|
328
328
|
}
|
|
329
329
|
});
|
|
@@ -583,7 +583,7 @@ var OpenAIChatLanguageModel = class {
|
|
|
583
583
|
toolCallType: "function",
|
|
584
584
|
toolCallId: (_b = toolCall.id) != null ? _b : generateId(),
|
|
585
585
|
toolName: toolCall.function.name,
|
|
586
|
-
|
|
586
|
+
input: toolCall.function.arguments
|
|
587
587
|
});
|
|
588
588
|
}
|
|
589
589
|
const completionTokenDetails = (_c = response.usage) == null ? void 0 : _c.completion_tokens_details;
|
|
@@ -748,7 +748,7 @@ var OpenAIChatLanguageModel = class {
|
|
|
748
748
|
toolCallType: "function",
|
|
749
749
|
toolCallId: toolCall2.id,
|
|
750
750
|
toolName: toolCall2.function.name,
|
|
751
|
-
|
|
751
|
+
inputTextDelta: toolCall2.function.arguments
|
|
752
752
|
});
|
|
753
753
|
}
|
|
754
754
|
if (isParsableJson(toolCall2.function.arguments)) {
|
|
@@ -757,7 +757,7 @@ var OpenAIChatLanguageModel = class {
|
|
|
757
757
|
toolCallType: "function",
|
|
758
758
|
toolCallId: (_q = toolCall2.id) != null ? _q : generateId(),
|
|
759
759
|
toolName: toolCall2.function.name,
|
|
760
|
-
|
|
760
|
+
input: toolCall2.function.arguments
|
|
761
761
|
});
|
|
762
762
|
toolCall2.hasFinished = true;
|
|
763
763
|
}
|
|
@@ -776,7 +776,7 @@ var OpenAIChatLanguageModel = class {
|
|
|
776
776
|
toolCallType: "function",
|
|
777
777
|
toolCallId: toolCall.id,
|
|
778
778
|
toolName: toolCall.function.name,
|
|
779
|
-
|
|
779
|
+
inputTextDelta: (_u = toolCallDelta.function.arguments) != null ? _u : ""
|
|
780
780
|
});
|
|
781
781
|
if (((_v = toolCall.function) == null ? void 0 : _v.name) != null && ((_w = toolCall.function) == null ? void 0 : _w.arguments) != null && isParsableJson(toolCall.function.arguments)) {
|
|
782
782
|
controller.enqueue({
|
|
@@ -784,7 +784,7 @@ var OpenAIChatLanguageModel = class {
|
|
|
784
784
|
toolCallType: "function",
|
|
785
785
|
toolCallId: (_x = toolCall.id) != null ? _x : generateId(),
|
|
786
786
|
toolName: toolCall.function.name,
|
|
787
|
-
|
|
787
|
+
input: toolCall.function.arguments
|
|
788
788
|
});
|
|
789
789
|
toolCall.hasFinished = true;
|
|
790
790
|
}
|
|
@@ -1551,7 +1551,7 @@ function webSearchPreviewTool({
|
|
|
1551
1551
|
userLocation
|
|
1552
1552
|
} = {}) {
|
|
1553
1553
|
return {
|
|
1554
|
-
type: "provider-defined",
|
|
1554
|
+
type: "provider-defined-client",
|
|
1555
1555
|
id: "openai.web_search_preview",
|
|
1556
1556
|
args: {
|
|
1557
1557
|
searchContextSize,
|
|
@@ -1863,7 +1863,7 @@ function convertToOpenAIResponsesMessages({
|
|
|
1863
1863
|
type: "function_call",
|
|
1864
1864
|
call_id: part.toolCallId,
|
|
1865
1865
|
name: part.toolName,
|
|
1866
|
-
arguments: JSON.stringify(part.
|
|
1866
|
+
arguments: JSON.stringify(part.input)
|
|
1867
1867
|
});
|
|
1868
1868
|
break;
|
|
1869
1869
|
}
|
|
@@ -1876,7 +1876,7 @@ function convertToOpenAIResponsesMessages({
|
|
|
1876
1876
|
messages.push({
|
|
1877
1877
|
type: "function_call_output",
|
|
1878
1878
|
call_id: part.toolCallId,
|
|
1879
|
-
output: JSON.stringify(part.
|
|
1879
|
+
output: JSON.stringify(part.output)
|
|
1880
1880
|
});
|
|
1881
1881
|
}
|
|
1882
1882
|
break;
|
|
@@ -1930,11 +1930,11 @@ function prepareResponsesTools({
|
|
|
1930
1930
|
type: "function",
|
|
1931
1931
|
name: tool.name,
|
|
1932
1932
|
description: tool.description,
|
|
1933
|
-
parameters: tool.
|
|
1933
|
+
parameters: tool.inputSchema,
|
|
1934
1934
|
strict: strict ? true : void 0
|
|
1935
1935
|
});
|
|
1936
1936
|
break;
|
|
1937
|
-
case "provider-defined":
|
|
1937
|
+
case "provider-defined-client":
|
|
1938
1938
|
switch (tool.id) {
|
|
1939
1939
|
case "openai.web_search_preview":
|
|
1940
1940
|
openaiTools2.push({
|
|
@@ -2229,7 +2229,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
2229
2229
|
toolCallType: "function",
|
|
2230
2230
|
toolCallId: part.call_id,
|
|
2231
2231
|
toolName: part.name,
|
|
2232
|
-
|
|
2232
|
+
input: part.arguments
|
|
2233
2233
|
});
|
|
2234
2234
|
break;
|
|
2235
2235
|
}
|
|
@@ -2322,7 +2322,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
2322
2322
|
toolCallType: "function",
|
|
2323
2323
|
toolCallId: value.item.call_id,
|
|
2324
2324
|
toolName: value.item.name,
|
|
2325
|
-
|
|
2325
|
+
inputTextDelta: value.item.arguments
|
|
2326
2326
|
});
|
|
2327
2327
|
}
|
|
2328
2328
|
} else if (isResponseFunctionCallArgumentsDeltaChunk(value)) {
|
|
@@ -2333,7 +2333,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
2333
2333
|
toolCallType: "function",
|
|
2334
2334
|
toolCallId: toolCall.toolCallId,
|
|
2335
2335
|
toolName: toolCall.toolName,
|
|
2336
|
-
|
|
2336
|
+
inputTextDelta: value.delta
|
|
2337
2337
|
});
|
|
2338
2338
|
}
|
|
2339
2339
|
} else if (isResponseCreatedChunk(value)) {
|
|
@@ -2368,7 +2368,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
2368
2368
|
toolCallType: "function",
|
|
2369
2369
|
toolCallId: value.item.call_id,
|
|
2370
2370
|
toolName: value.item.name,
|
|
2371
|
-
|
|
2371
|
+
input: value.item.arguments
|
|
2372
2372
|
});
|
|
2373
2373
|
} else if (isResponseFinishedChunk(value)) {
|
|
2374
2374
|
finishReason = mapOpenAIResponseFinishReason({
|