@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/internal/index.mjs
CHANGED
|
@@ -147,7 +147,7 @@ function convertToOpenAIChatMessages({
|
|
|
147
147
|
type: "function",
|
|
148
148
|
function: {
|
|
149
149
|
name: part.toolName,
|
|
150
|
-
arguments: JSON.stringify(part.
|
|
150
|
+
arguments: JSON.stringify(part.input)
|
|
151
151
|
}
|
|
152
152
|
});
|
|
153
153
|
break;
|
|
@@ -166,7 +166,7 @@ function convertToOpenAIChatMessages({
|
|
|
166
166
|
messages.push({
|
|
167
167
|
role: "tool",
|
|
168
168
|
tool_call_id: toolResponse.toolCallId,
|
|
169
|
-
content: JSON.stringify(toolResponse.
|
|
169
|
+
content: JSON.stringify(toolResponse.output)
|
|
170
170
|
});
|
|
171
171
|
}
|
|
172
172
|
break;
|
|
@@ -309,7 +309,7 @@ function prepareTools({
|
|
|
309
309
|
}
|
|
310
310
|
const openaiTools = [];
|
|
311
311
|
for (const tool of tools) {
|
|
312
|
-
if (tool.type === "provider-defined") {
|
|
312
|
+
if (tool.type === "provider-defined-client" || tool.type === "provider-defined-server") {
|
|
313
313
|
toolWarnings.push({ type: "unsupported-tool", tool });
|
|
314
314
|
} else {
|
|
315
315
|
openaiTools.push({
|
|
@@ -317,7 +317,7 @@ function prepareTools({
|
|
|
317
317
|
function: {
|
|
318
318
|
name: tool.name,
|
|
319
319
|
description: tool.description,
|
|
320
|
-
parameters: tool.
|
|
320
|
+
parameters: tool.inputSchema,
|
|
321
321
|
strict: structuredOutputs ? true : void 0
|
|
322
322
|
}
|
|
323
323
|
});
|
|
@@ -577,7 +577,7 @@ var OpenAIChatLanguageModel = class {
|
|
|
577
577
|
toolCallType: "function",
|
|
578
578
|
toolCallId: (_b = toolCall.id) != null ? _b : generateId(),
|
|
579
579
|
toolName: toolCall.function.name,
|
|
580
|
-
|
|
580
|
+
input: toolCall.function.arguments
|
|
581
581
|
});
|
|
582
582
|
}
|
|
583
583
|
const completionTokenDetails = (_c = response.usage) == null ? void 0 : _c.completion_tokens_details;
|
|
@@ -742,7 +742,7 @@ var OpenAIChatLanguageModel = class {
|
|
|
742
742
|
toolCallType: "function",
|
|
743
743
|
toolCallId: toolCall2.id,
|
|
744
744
|
toolName: toolCall2.function.name,
|
|
745
|
-
|
|
745
|
+
inputTextDelta: toolCall2.function.arguments
|
|
746
746
|
});
|
|
747
747
|
}
|
|
748
748
|
if (isParsableJson(toolCall2.function.arguments)) {
|
|
@@ -751,7 +751,7 @@ var OpenAIChatLanguageModel = class {
|
|
|
751
751
|
toolCallType: "function",
|
|
752
752
|
toolCallId: (_q = toolCall2.id) != null ? _q : generateId(),
|
|
753
753
|
toolName: toolCall2.function.name,
|
|
754
|
-
|
|
754
|
+
input: toolCall2.function.arguments
|
|
755
755
|
});
|
|
756
756
|
toolCall2.hasFinished = true;
|
|
757
757
|
}
|
|
@@ -770,7 +770,7 @@ var OpenAIChatLanguageModel = class {
|
|
|
770
770
|
toolCallType: "function",
|
|
771
771
|
toolCallId: toolCall.id,
|
|
772
772
|
toolName: toolCall.function.name,
|
|
773
|
-
|
|
773
|
+
inputTextDelta: (_u = toolCallDelta.function.arguments) != null ? _u : ""
|
|
774
774
|
});
|
|
775
775
|
if (((_v = toolCall.function) == null ? void 0 : _v.name) != null && ((_w = toolCall.function) == null ? void 0 : _w.arguments) != null && isParsableJson(toolCall.function.arguments)) {
|
|
776
776
|
controller.enqueue({
|
|
@@ -778,7 +778,7 @@ var OpenAIChatLanguageModel = class {
|
|
|
778
778
|
toolCallType: "function",
|
|
779
779
|
toolCallId: (_x = toolCall.id) != null ? _x : generateId(),
|
|
780
780
|
toolName: toolCall.function.name,
|
|
781
|
-
|
|
781
|
+
input: toolCall.function.arguments
|
|
782
782
|
});
|
|
783
783
|
toolCall.hasFinished = true;
|
|
784
784
|
}
|
|
@@ -1940,7 +1940,7 @@ function convertToOpenAIResponsesMessages({
|
|
|
1940
1940
|
type: "function_call",
|
|
1941
1941
|
call_id: part.toolCallId,
|
|
1942
1942
|
name: part.toolName,
|
|
1943
|
-
arguments: JSON.stringify(part.
|
|
1943
|
+
arguments: JSON.stringify(part.input)
|
|
1944
1944
|
});
|
|
1945
1945
|
break;
|
|
1946
1946
|
}
|
|
@@ -1953,7 +1953,7 @@ function convertToOpenAIResponsesMessages({
|
|
|
1953
1953
|
messages.push({
|
|
1954
1954
|
type: "function_call_output",
|
|
1955
1955
|
call_id: part.toolCallId,
|
|
1956
|
-
output: JSON.stringify(part.
|
|
1956
|
+
output: JSON.stringify(part.output)
|
|
1957
1957
|
});
|
|
1958
1958
|
}
|
|
1959
1959
|
break;
|
|
@@ -2007,11 +2007,11 @@ function prepareResponsesTools({
|
|
|
2007
2007
|
type: "function",
|
|
2008
2008
|
name: tool.name,
|
|
2009
2009
|
description: tool.description,
|
|
2010
|
-
parameters: tool.
|
|
2010
|
+
parameters: tool.inputSchema,
|
|
2011
2011
|
strict: strict ? true : void 0
|
|
2012
2012
|
});
|
|
2013
2013
|
break;
|
|
2014
|
-
case "provider-defined":
|
|
2014
|
+
case "provider-defined-client":
|
|
2015
2015
|
switch (tool.id) {
|
|
2016
2016
|
case "openai.web_search_preview":
|
|
2017
2017
|
openaiTools.push({
|
|
@@ -2306,7 +2306,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
2306
2306
|
toolCallType: "function",
|
|
2307
2307
|
toolCallId: part.call_id,
|
|
2308
2308
|
toolName: part.name,
|
|
2309
|
-
|
|
2309
|
+
input: part.arguments
|
|
2310
2310
|
});
|
|
2311
2311
|
break;
|
|
2312
2312
|
}
|
|
@@ -2399,7 +2399,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
2399
2399
|
toolCallType: "function",
|
|
2400
2400
|
toolCallId: value.item.call_id,
|
|
2401
2401
|
toolName: value.item.name,
|
|
2402
|
-
|
|
2402
|
+
inputTextDelta: value.item.arguments
|
|
2403
2403
|
});
|
|
2404
2404
|
}
|
|
2405
2405
|
} else if (isResponseFunctionCallArgumentsDeltaChunk(value)) {
|
|
@@ -2410,7 +2410,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
2410
2410
|
toolCallType: "function",
|
|
2411
2411
|
toolCallId: toolCall.toolCallId,
|
|
2412
2412
|
toolName: toolCall.toolName,
|
|
2413
|
-
|
|
2413
|
+
inputTextDelta: value.delta
|
|
2414
2414
|
});
|
|
2415
2415
|
}
|
|
2416
2416
|
} else if (isResponseCreatedChunk(value)) {
|
|
@@ -2445,7 +2445,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
2445
2445
|
toolCallType: "function",
|
|
2446
2446
|
toolCallId: value.item.call_id,
|
|
2447
2447
|
toolName: value.item.name,
|
|
2448
|
-
|
|
2448
|
+
input: value.item.arguments
|
|
2449
2449
|
});
|
|
2450
2450
|
} else if (isResponseFinishedChunk(value)) {
|
|
2451
2451
|
finishReason = mapOpenAIResponseFinishReason({
|