@ai-sdk/openai 2.0.0-beta.6 → 2.0.0-beta.8
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 +14 -0
- package/dist/index.js +32 -10
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +32 -10
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.js +32 -10
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +32 -10
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/index.mjs
CHANGED
|
@@ -1906,7 +1906,7 @@ async function convertToOpenAIResponsesMessages({
|
|
|
1906
1906
|
prompt,
|
|
1907
1907
|
systemMessageMode
|
|
1908
1908
|
}) {
|
|
1909
|
-
var _a, _b;
|
|
1909
|
+
var _a, _b, _c, _d, _e;
|
|
1910
1910
|
const messages = [];
|
|
1911
1911
|
const warnings = [];
|
|
1912
1912
|
for (const { role, content } of prompt) {
|
|
@@ -1941,7 +1941,7 @@ async function convertToOpenAIResponsesMessages({
|
|
|
1941
1941
|
messages.push({
|
|
1942
1942
|
role: "user",
|
|
1943
1943
|
content: content.map((part, index) => {
|
|
1944
|
-
var _a2, _b2,
|
|
1944
|
+
var _a2, _b2, _c2;
|
|
1945
1945
|
switch (part.type) {
|
|
1946
1946
|
case "text": {
|
|
1947
1947
|
return { type: "input_text", text: part.text };
|
|
@@ -1963,7 +1963,7 @@ async function convertToOpenAIResponsesMessages({
|
|
|
1963
1963
|
}
|
|
1964
1964
|
return {
|
|
1965
1965
|
type: "input_file",
|
|
1966
|
-
filename: (
|
|
1966
|
+
filename: (_c2 = part.filename) != null ? _c2 : `part-${index}.pdf`,
|
|
1967
1967
|
file_data: `data:application/pdf;base64,${part.data}`
|
|
1968
1968
|
};
|
|
1969
1969
|
} else {
|
|
@@ -1996,7 +1996,8 @@ async function convertToOpenAIResponsesMessages({
|
|
|
1996
1996
|
type: "function_call",
|
|
1997
1997
|
call_id: part.toolCallId,
|
|
1998
1998
|
name: part.toolName,
|
|
1999
|
-
arguments: JSON.stringify(part.input)
|
|
1999
|
+
arguments: JSON.stringify(part.input),
|
|
2000
|
+
id: (_c = (_b = (_a = part.providerOptions) == null ? void 0 : _a.openai) == null ? void 0 : _b.itemId) != null ? _c : void 0
|
|
2000
2001
|
});
|
|
2001
2002
|
break;
|
|
2002
2003
|
}
|
|
@@ -2013,7 +2014,7 @@ async function convertToOpenAIResponsesMessages({
|
|
|
2013
2014
|
providerOptions: part.providerOptions,
|
|
2014
2015
|
schema: openaiResponsesReasoningProviderOptionsSchema
|
|
2015
2016
|
});
|
|
2016
|
-
const reasoningId = (
|
|
2017
|
+
const reasoningId = (_d = providerOptions == null ? void 0 : providerOptions.reasoning) == null ? void 0 : _d.id;
|
|
2017
2018
|
if (reasoningId != null) {
|
|
2018
2019
|
const existingReasoningMessage = reasoningMessages[reasoningId];
|
|
2019
2020
|
const summaryParts = [];
|
|
@@ -2029,7 +2030,7 @@ async function convertToOpenAIResponsesMessages({
|
|
|
2029
2030
|
reasoningMessages[reasoningId] = {
|
|
2030
2031
|
type: "reasoning",
|
|
2031
2032
|
id: reasoningId,
|
|
2032
|
-
encrypted_content: (
|
|
2033
|
+
encrypted_content: (_e = providerOptions == null ? void 0 : providerOptions.reasoning) == null ? void 0 : _e.encryptedContent,
|
|
2033
2034
|
summary: summaryParts
|
|
2034
2035
|
};
|
|
2035
2036
|
messages.push(reasoningMessages[reasoningId]);
|
|
@@ -2132,6 +2133,16 @@ function prepareResponsesTools({
|
|
|
2132
2133
|
break;
|
|
2133
2134
|
case "provider-defined":
|
|
2134
2135
|
switch (tool.id) {
|
|
2136
|
+
case "openai.file_search": {
|
|
2137
|
+
const args = fileSearchArgsSchema.parse(tool.args);
|
|
2138
|
+
openaiTools2.push({
|
|
2139
|
+
type: "file_search",
|
|
2140
|
+
vector_store_ids: args.vectorStoreIds,
|
|
2141
|
+
max_results: args.maxResults,
|
|
2142
|
+
search_type: args.searchType
|
|
2143
|
+
});
|
|
2144
|
+
break;
|
|
2145
|
+
}
|
|
2135
2146
|
case "openai.web_search_preview":
|
|
2136
2147
|
openaiTools2.push({
|
|
2137
2148
|
type: "web_search_preview",
|
|
@@ -2161,7 +2172,7 @@ function prepareResponsesTools({
|
|
|
2161
2172
|
case "tool":
|
|
2162
2173
|
return {
|
|
2163
2174
|
tools: openaiTools2,
|
|
2164
|
-
toolChoice: toolChoice.toolName === "web_search_preview" ? { type: "web_search_preview" } : { type: "function", name: toolChoice.toolName },
|
|
2175
|
+
toolChoice: toolChoice.toolName === "file_search" ? { type: "file_search" } : toolChoice.toolName === "web_search_preview" ? { type: "web_search_preview" } : { type: "function", name: toolChoice.toolName },
|
|
2165
2176
|
toolWarnings
|
|
2166
2177
|
};
|
|
2167
2178
|
default: {
|
|
@@ -2386,7 +2397,8 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
2386
2397
|
type: z14.literal("function_call"),
|
|
2387
2398
|
call_id: z14.string(),
|
|
2388
2399
|
name: z14.string(),
|
|
2389
|
-
arguments: z14.string()
|
|
2400
|
+
arguments: z14.string(),
|
|
2401
|
+
id: z14.string()
|
|
2390
2402
|
}),
|
|
2391
2403
|
z14.object({
|
|
2392
2404
|
type: z14.literal("web_search_call"),
|
|
@@ -2475,7 +2487,12 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
2475
2487
|
type: "tool-call",
|
|
2476
2488
|
toolCallId: part.call_id,
|
|
2477
2489
|
toolName: part.name,
|
|
2478
|
-
input: part.arguments
|
|
2490
|
+
input: part.arguments,
|
|
2491
|
+
providerMetadata: {
|
|
2492
|
+
openai: {
|
|
2493
|
+
itemId: part.id
|
|
2494
|
+
}
|
|
2495
|
+
}
|
|
2479
2496
|
});
|
|
2480
2497
|
break;
|
|
2481
2498
|
}
|
|
@@ -2660,7 +2677,12 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
2660
2677
|
type: "tool-call",
|
|
2661
2678
|
toolCallId: value.item.call_id,
|
|
2662
2679
|
toolName: value.item.name,
|
|
2663
|
-
input: value.item.arguments
|
|
2680
|
+
input: value.item.arguments,
|
|
2681
|
+
providerMetadata: {
|
|
2682
|
+
openai: {
|
|
2683
|
+
itemId: value.item.id
|
|
2684
|
+
}
|
|
2685
|
+
}
|
|
2664
2686
|
});
|
|
2665
2687
|
} else if (value.item.type === "web_search_call") {
|
|
2666
2688
|
ongoingToolCalls[value.output_index] = void 0;
|