@ai-sdk/openai 2.0.0-alpha.13 → 2.0.0-alpha.15
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 +19 -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/internal/index.js
CHANGED
|
@@ -173,7 +173,7 @@ function convertToOpenAIChatMessages({
|
|
|
173
173
|
type: "function",
|
|
174
174
|
function: {
|
|
175
175
|
name: part.toolName,
|
|
176
|
-
arguments: JSON.stringify(part.
|
|
176
|
+
arguments: JSON.stringify(part.input)
|
|
177
177
|
}
|
|
178
178
|
});
|
|
179
179
|
break;
|
|
@@ -192,7 +192,7 @@ function convertToOpenAIChatMessages({
|
|
|
192
192
|
messages.push({
|
|
193
193
|
role: "tool",
|
|
194
194
|
tool_call_id: toolResponse.toolCallId,
|
|
195
|
-
content: JSON.stringify(toolResponse.
|
|
195
|
+
content: JSON.stringify(toolResponse.output)
|
|
196
196
|
});
|
|
197
197
|
}
|
|
198
198
|
break;
|
|
@@ -333,7 +333,7 @@ function prepareTools({
|
|
|
333
333
|
}
|
|
334
334
|
const openaiTools = [];
|
|
335
335
|
for (const tool of tools) {
|
|
336
|
-
if (tool.type === "provider-defined") {
|
|
336
|
+
if (tool.type === "provider-defined-client" || tool.type === "provider-defined-server") {
|
|
337
337
|
toolWarnings.push({ type: "unsupported-tool", tool });
|
|
338
338
|
} else {
|
|
339
339
|
openaiTools.push({
|
|
@@ -341,7 +341,7 @@ function prepareTools({
|
|
|
341
341
|
function: {
|
|
342
342
|
name: tool.name,
|
|
343
343
|
description: tool.description,
|
|
344
|
-
parameters: tool.
|
|
344
|
+
parameters: tool.inputSchema,
|
|
345
345
|
strict: structuredOutputs ? true : void 0
|
|
346
346
|
}
|
|
347
347
|
});
|
|
@@ -601,7 +601,7 @@ var OpenAIChatLanguageModel = class {
|
|
|
601
601
|
toolCallType: "function",
|
|
602
602
|
toolCallId: (_b = toolCall.id) != null ? _b : (0, import_provider_utils3.generateId)(),
|
|
603
603
|
toolName: toolCall.function.name,
|
|
604
|
-
|
|
604
|
+
input: toolCall.function.arguments
|
|
605
605
|
});
|
|
606
606
|
}
|
|
607
607
|
const completionTokenDetails = (_c = response.usage) == null ? void 0 : _c.completion_tokens_details;
|
|
@@ -766,7 +766,7 @@ var OpenAIChatLanguageModel = class {
|
|
|
766
766
|
toolCallType: "function",
|
|
767
767
|
toolCallId: toolCall2.id,
|
|
768
768
|
toolName: toolCall2.function.name,
|
|
769
|
-
|
|
769
|
+
inputTextDelta: toolCall2.function.arguments
|
|
770
770
|
});
|
|
771
771
|
}
|
|
772
772
|
if ((0, import_provider_utils3.isParsableJson)(toolCall2.function.arguments)) {
|
|
@@ -775,7 +775,7 @@ var OpenAIChatLanguageModel = class {
|
|
|
775
775
|
toolCallType: "function",
|
|
776
776
|
toolCallId: (_q = toolCall2.id) != null ? _q : (0, import_provider_utils3.generateId)(),
|
|
777
777
|
toolName: toolCall2.function.name,
|
|
778
|
-
|
|
778
|
+
input: toolCall2.function.arguments
|
|
779
779
|
});
|
|
780
780
|
toolCall2.hasFinished = true;
|
|
781
781
|
}
|
|
@@ -794,7 +794,7 @@ var OpenAIChatLanguageModel = class {
|
|
|
794
794
|
toolCallType: "function",
|
|
795
795
|
toolCallId: toolCall.id,
|
|
796
796
|
toolName: toolCall.function.name,
|
|
797
|
-
|
|
797
|
+
inputTextDelta: (_u = toolCallDelta.function.arguments) != null ? _u : ""
|
|
798
798
|
});
|
|
799
799
|
if (((_v = toolCall.function) == null ? void 0 : _v.name) != null && ((_w = toolCall.function) == null ? void 0 : _w.arguments) != null && (0, import_provider_utils3.isParsableJson)(toolCall.function.arguments)) {
|
|
800
800
|
controller.enqueue({
|
|
@@ -802,7 +802,7 @@ var OpenAIChatLanguageModel = class {
|
|
|
802
802
|
toolCallType: "function",
|
|
803
803
|
toolCallId: (_x = toolCall.id) != null ? _x : (0, import_provider_utils3.generateId)(),
|
|
804
804
|
toolName: toolCall.function.name,
|
|
805
|
-
|
|
805
|
+
input: toolCall.function.arguments
|
|
806
806
|
});
|
|
807
807
|
toolCall.hasFinished = true;
|
|
808
808
|
}
|
|
@@ -1924,7 +1924,7 @@ function convertToOpenAIResponsesMessages({
|
|
|
1924
1924
|
type: "function_call",
|
|
1925
1925
|
call_id: part.toolCallId,
|
|
1926
1926
|
name: part.toolName,
|
|
1927
|
-
arguments: JSON.stringify(part.
|
|
1927
|
+
arguments: JSON.stringify(part.input)
|
|
1928
1928
|
});
|
|
1929
1929
|
break;
|
|
1930
1930
|
}
|
|
@@ -1937,7 +1937,7 @@ function convertToOpenAIResponsesMessages({
|
|
|
1937
1937
|
messages.push({
|
|
1938
1938
|
type: "function_call_output",
|
|
1939
1939
|
call_id: part.toolCallId,
|
|
1940
|
-
output: JSON.stringify(part.
|
|
1940
|
+
output: JSON.stringify(part.output)
|
|
1941
1941
|
});
|
|
1942
1942
|
}
|
|
1943
1943
|
break;
|
|
@@ -1989,11 +1989,11 @@ function prepareResponsesTools({
|
|
|
1989
1989
|
type: "function",
|
|
1990
1990
|
name: tool.name,
|
|
1991
1991
|
description: tool.description,
|
|
1992
|
-
parameters: tool.
|
|
1992
|
+
parameters: tool.inputSchema,
|
|
1993
1993
|
strict: strict ? true : void 0
|
|
1994
1994
|
});
|
|
1995
1995
|
break;
|
|
1996
|
-
case "provider-defined":
|
|
1996
|
+
case "provider-defined-client":
|
|
1997
1997
|
switch (tool.id) {
|
|
1998
1998
|
case "openai.web_search_preview":
|
|
1999
1999
|
openaiTools.push({
|
|
@@ -2288,7 +2288,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
2288
2288
|
toolCallType: "function",
|
|
2289
2289
|
toolCallId: part.call_id,
|
|
2290
2290
|
toolName: part.name,
|
|
2291
|
-
|
|
2291
|
+
input: part.arguments
|
|
2292
2292
|
});
|
|
2293
2293
|
break;
|
|
2294
2294
|
}
|
|
@@ -2381,7 +2381,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
2381
2381
|
toolCallType: "function",
|
|
2382
2382
|
toolCallId: value.item.call_id,
|
|
2383
2383
|
toolName: value.item.name,
|
|
2384
|
-
|
|
2384
|
+
inputTextDelta: value.item.arguments
|
|
2385
2385
|
});
|
|
2386
2386
|
}
|
|
2387
2387
|
} else if (isResponseFunctionCallArgumentsDeltaChunk(value)) {
|
|
@@ -2392,7 +2392,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
2392
2392
|
toolCallType: "function",
|
|
2393
2393
|
toolCallId: toolCall.toolCallId,
|
|
2394
2394
|
toolName: toolCall.toolName,
|
|
2395
|
-
|
|
2395
|
+
inputTextDelta: value.delta
|
|
2396
2396
|
});
|
|
2397
2397
|
}
|
|
2398
2398
|
} else if (isResponseCreatedChunk(value)) {
|
|
@@ -2427,7 +2427,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
2427
2427
|
toolCallType: "function",
|
|
2428
2428
|
toolCallId: value.item.call_id,
|
|
2429
2429
|
toolName: value.item.name,
|
|
2430
|
-
|
|
2430
|
+
input: value.item.arguments
|
|
2431
2431
|
});
|
|
2432
2432
|
} else if (isResponseFinishedChunk(value)) {
|
|
2433
2433
|
finishReason = mapOpenAIResponseFinishReason({
|