@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/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# @ai-sdk/openai
|
|
2
2
|
|
|
3
|
+
## 2.0.0-alpha.14
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [b5da06a]
|
|
8
|
+
- Updated dependencies [63f9e9b]
|
|
9
|
+
- Updated dependencies [2e13791]
|
|
10
|
+
- @ai-sdk/provider@2.0.0-alpha.14
|
|
11
|
+
- @ai-sdk/provider-utils@3.0.0-alpha.14
|
|
12
|
+
|
|
3
13
|
## 2.0.0-alpha.13
|
|
4
14
|
|
|
5
15
|
### Patch Changes
|
package/dist/index.d.mts
CHANGED
|
@@ -43,7 +43,7 @@ declare function webSearchPreviewTool({ searchContextSize, userLocation, }?: {
|
|
|
43
43
|
timezone?: string;
|
|
44
44
|
};
|
|
45
45
|
}): {
|
|
46
|
-
type: 'provider-defined';
|
|
46
|
+
type: 'provider-defined-client';
|
|
47
47
|
id: 'openai.web_search_preview';
|
|
48
48
|
args: {};
|
|
49
49
|
parameters: typeof WebSearchPreviewParameters;
|
package/dist/index.d.ts
CHANGED
|
@@ -43,7 +43,7 @@ declare function webSearchPreviewTool({ searchContextSize, userLocation, }?: {
|
|
|
43
43
|
timezone?: string;
|
|
44
44
|
};
|
|
45
45
|
}): {
|
|
46
|
-
type: 'provider-defined';
|
|
46
|
+
type: 'provider-defined-client';
|
|
47
47
|
id: 'openai.web_search_preview';
|
|
48
48
|
args: {};
|
|
49
49
|
parameters: typeof WebSearchPreviewParameters;
|
package/dist/index.js
CHANGED
|
@@ -165,7 +165,7 @@ function convertToOpenAIChatMessages({
|
|
|
165
165
|
type: "function",
|
|
166
166
|
function: {
|
|
167
167
|
name: part.toolName,
|
|
168
|
-
arguments: JSON.stringify(part.
|
|
168
|
+
arguments: JSON.stringify(part.input)
|
|
169
169
|
}
|
|
170
170
|
});
|
|
171
171
|
break;
|
|
@@ -184,7 +184,7 @@ function convertToOpenAIChatMessages({
|
|
|
184
184
|
messages.push({
|
|
185
185
|
role: "tool",
|
|
186
186
|
tool_call_id: toolResponse.toolCallId,
|
|
187
|
-
content: JSON.stringify(toolResponse.
|
|
187
|
+
content: JSON.stringify(toolResponse.output)
|
|
188
188
|
});
|
|
189
189
|
}
|
|
190
190
|
break;
|
|
@@ -325,7 +325,7 @@ function prepareTools({
|
|
|
325
325
|
}
|
|
326
326
|
const openaiTools2 = [];
|
|
327
327
|
for (const tool of tools) {
|
|
328
|
-
if (tool.type === "provider-defined") {
|
|
328
|
+
if (tool.type === "provider-defined-client" || tool.type === "provider-defined-server") {
|
|
329
329
|
toolWarnings.push({ type: "unsupported-tool", tool });
|
|
330
330
|
} else {
|
|
331
331
|
openaiTools2.push({
|
|
@@ -333,7 +333,7 @@ function prepareTools({
|
|
|
333
333
|
function: {
|
|
334
334
|
name: tool.name,
|
|
335
335
|
description: tool.description,
|
|
336
|
-
parameters: tool.
|
|
336
|
+
parameters: tool.inputSchema,
|
|
337
337
|
strict: structuredOutputs ? true : void 0
|
|
338
338
|
}
|
|
339
339
|
});
|
|
@@ -593,7 +593,7 @@ var OpenAIChatLanguageModel = class {
|
|
|
593
593
|
toolCallType: "function",
|
|
594
594
|
toolCallId: (_b = toolCall.id) != null ? _b : (0, import_provider_utils3.generateId)(),
|
|
595
595
|
toolName: toolCall.function.name,
|
|
596
|
-
|
|
596
|
+
input: toolCall.function.arguments
|
|
597
597
|
});
|
|
598
598
|
}
|
|
599
599
|
const completionTokenDetails = (_c = response.usage) == null ? void 0 : _c.completion_tokens_details;
|
|
@@ -758,7 +758,7 @@ var OpenAIChatLanguageModel = class {
|
|
|
758
758
|
toolCallType: "function",
|
|
759
759
|
toolCallId: toolCall2.id,
|
|
760
760
|
toolName: toolCall2.function.name,
|
|
761
|
-
|
|
761
|
+
inputTextDelta: toolCall2.function.arguments
|
|
762
762
|
});
|
|
763
763
|
}
|
|
764
764
|
if ((0, import_provider_utils3.isParsableJson)(toolCall2.function.arguments)) {
|
|
@@ -767,7 +767,7 @@ var OpenAIChatLanguageModel = class {
|
|
|
767
767
|
toolCallType: "function",
|
|
768
768
|
toolCallId: (_q = toolCall2.id) != null ? _q : (0, import_provider_utils3.generateId)(),
|
|
769
769
|
toolName: toolCall2.function.name,
|
|
770
|
-
|
|
770
|
+
input: toolCall2.function.arguments
|
|
771
771
|
});
|
|
772
772
|
toolCall2.hasFinished = true;
|
|
773
773
|
}
|
|
@@ -786,7 +786,7 @@ var OpenAIChatLanguageModel = class {
|
|
|
786
786
|
toolCallType: "function",
|
|
787
787
|
toolCallId: toolCall.id,
|
|
788
788
|
toolName: toolCall.function.name,
|
|
789
|
-
|
|
789
|
+
inputTextDelta: (_u = toolCallDelta.function.arguments) != null ? _u : ""
|
|
790
790
|
});
|
|
791
791
|
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)) {
|
|
792
792
|
controller.enqueue({
|
|
@@ -794,7 +794,7 @@ var OpenAIChatLanguageModel = class {
|
|
|
794
794
|
toolCallType: "function",
|
|
795
795
|
toolCallId: (_x = toolCall.id) != null ? _x : (0, import_provider_utils3.generateId)(),
|
|
796
796
|
toolName: toolCall.function.name,
|
|
797
|
-
|
|
797
|
+
input: toolCall.function.arguments
|
|
798
798
|
});
|
|
799
799
|
toolCall.hasFinished = true;
|
|
800
800
|
}
|
|
@@ -1541,7 +1541,7 @@ function webSearchPreviewTool({
|
|
|
1541
1541
|
userLocation
|
|
1542
1542
|
} = {}) {
|
|
1543
1543
|
return {
|
|
1544
|
-
type: "provider-defined",
|
|
1544
|
+
type: "provider-defined-client",
|
|
1545
1545
|
id: "openai.web_search_preview",
|
|
1546
1546
|
args: {
|
|
1547
1547
|
searchContextSize,
|
|
@@ -1838,7 +1838,7 @@ function convertToOpenAIResponsesMessages({
|
|
|
1838
1838
|
type: "function_call",
|
|
1839
1839
|
call_id: part.toolCallId,
|
|
1840
1840
|
name: part.toolName,
|
|
1841
|
-
arguments: JSON.stringify(part.
|
|
1841
|
+
arguments: JSON.stringify(part.input)
|
|
1842
1842
|
});
|
|
1843
1843
|
break;
|
|
1844
1844
|
}
|
|
@@ -1851,7 +1851,7 @@ function convertToOpenAIResponsesMessages({
|
|
|
1851
1851
|
messages.push({
|
|
1852
1852
|
type: "function_call_output",
|
|
1853
1853
|
call_id: part.toolCallId,
|
|
1854
|
-
output: JSON.stringify(part.
|
|
1854
|
+
output: JSON.stringify(part.output)
|
|
1855
1855
|
});
|
|
1856
1856
|
}
|
|
1857
1857
|
break;
|
|
@@ -1903,11 +1903,11 @@ function prepareResponsesTools({
|
|
|
1903
1903
|
type: "function",
|
|
1904
1904
|
name: tool.name,
|
|
1905
1905
|
description: tool.description,
|
|
1906
|
-
parameters: tool.
|
|
1906
|
+
parameters: tool.inputSchema,
|
|
1907
1907
|
strict: strict ? true : void 0
|
|
1908
1908
|
});
|
|
1909
1909
|
break;
|
|
1910
|
-
case "provider-defined":
|
|
1910
|
+
case "provider-defined-client":
|
|
1911
1911
|
switch (tool.id) {
|
|
1912
1912
|
case "openai.web_search_preview":
|
|
1913
1913
|
openaiTools2.push({
|
|
@@ -2202,7 +2202,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
2202
2202
|
toolCallType: "function",
|
|
2203
2203
|
toolCallId: part.call_id,
|
|
2204
2204
|
toolName: part.name,
|
|
2205
|
-
|
|
2205
|
+
input: part.arguments
|
|
2206
2206
|
});
|
|
2207
2207
|
break;
|
|
2208
2208
|
}
|
|
@@ -2295,7 +2295,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
2295
2295
|
toolCallType: "function",
|
|
2296
2296
|
toolCallId: value.item.call_id,
|
|
2297
2297
|
toolName: value.item.name,
|
|
2298
|
-
|
|
2298
|
+
inputTextDelta: value.item.arguments
|
|
2299
2299
|
});
|
|
2300
2300
|
}
|
|
2301
2301
|
} else if (isResponseFunctionCallArgumentsDeltaChunk(value)) {
|
|
@@ -2306,7 +2306,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
2306
2306
|
toolCallType: "function",
|
|
2307
2307
|
toolCallId: toolCall.toolCallId,
|
|
2308
2308
|
toolName: toolCall.toolName,
|
|
2309
|
-
|
|
2309
|
+
inputTextDelta: value.delta
|
|
2310
2310
|
});
|
|
2311
2311
|
}
|
|
2312
2312
|
} else if (isResponseCreatedChunk(value)) {
|
|
@@ -2341,7 +2341,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
2341
2341
|
toolCallType: "function",
|
|
2342
2342
|
toolCallId: value.item.call_id,
|
|
2343
2343
|
toolName: value.item.name,
|
|
2344
|
-
|
|
2344
|
+
input: value.item.arguments
|
|
2345
2345
|
});
|
|
2346
2346
|
} else if (isResponseFinishedChunk(value)) {
|
|
2347
2347
|
finishReason = mapOpenAIResponseFinishReason({
|