@ai-sdk/openai 2.0.38 → 2.1.0-beta.1
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 +11 -43
- package/dist/index.d.mts +1 -34
- package/dist/index.d.ts +1 -34
- package/dist/index.js +33 -54
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +34 -55
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.d.mts +3 -214
- package/dist/internal/index.d.ts +3 -214
- package/dist/internal/index.js +27 -59
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +25 -49
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +5 -4
package/dist/internal/index.mjs
CHANGED
|
@@ -244,7 +244,7 @@ function mapOpenAIFinishReason(finishReason) {
|
|
|
244
244
|
|
|
245
245
|
// src/chat/openai-chat-options.ts
|
|
246
246
|
import { z as z2 } from "zod/v4";
|
|
247
|
-
var
|
|
247
|
+
var openaiProviderOptions = z2.object({
|
|
248
248
|
/**
|
|
249
249
|
* Modify the likelihood of specified tokens appearing in the completion.
|
|
250
250
|
*
|
|
@@ -428,7 +428,7 @@ var OpenAIChatLanguageModel = class {
|
|
|
428
428
|
const openaiOptions = (_a = await parseProviderOptions({
|
|
429
429
|
provider: "openai",
|
|
430
430
|
providerOptions,
|
|
431
|
-
schema:
|
|
431
|
+
schema: openaiProviderOptions
|
|
432
432
|
})) != null ? _a : {};
|
|
433
433
|
const structuredOutputs = (_b = openaiOptions.structuredOutputs) != null ? _b : true;
|
|
434
434
|
if (topK != null) {
|
|
@@ -2156,6 +2156,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
2156
2156
|
});
|
|
2157
2157
|
break;
|
|
2158
2158
|
}
|
|
2159
|
+
// assistant tool result parts are from provider-executed tools:
|
|
2159
2160
|
case "tool-result": {
|
|
2160
2161
|
if (store) {
|
|
2161
2162
|
input.push({ type: "item_reference", id: part.toolCallId });
|
|
@@ -2175,40 +2176,26 @@ async function convertToOpenAIResponsesInput({
|
|
|
2175
2176
|
});
|
|
2176
2177
|
const reasoningId = providerOptions == null ? void 0 : providerOptions.itemId;
|
|
2177
2178
|
if (reasoningId != null) {
|
|
2178
|
-
const
|
|
2179
|
-
|
|
2180
|
-
|
|
2181
|
-
|
|
2182
|
-
|
|
2183
|
-
|
|
2184
|
-
|
|
2185
|
-
|
|
2186
|
-
|
|
2187
|
-
|
|
2179
|
+
const existingReasoningMessage = reasoningMessages[reasoningId];
|
|
2180
|
+
const summaryParts = [];
|
|
2181
|
+
if (part.text.length > 0) {
|
|
2182
|
+
summaryParts.push({ type: "summary_text", text: part.text });
|
|
2183
|
+
} else if (existingReasoningMessage !== void 0) {
|
|
2184
|
+
warnings.push({
|
|
2185
|
+
type: "other",
|
|
2186
|
+
message: `Cannot append empty reasoning part to existing reasoning sequence. Skipping reasoning part: ${JSON.stringify(part)}.`
|
|
2187
|
+
});
|
|
2188
|
+
}
|
|
2189
|
+
if (existingReasoningMessage === void 0) {
|
|
2190
|
+
reasoningMessages[reasoningId] = {
|
|
2191
|
+
type: "reasoning",
|
|
2192
|
+
id: reasoningId,
|
|
2193
|
+
encrypted_content: providerOptions == null ? void 0 : providerOptions.reasoningEncryptedContent,
|
|
2194
|
+
summary: summaryParts
|
|
2195
|
+
};
|
|
2196
|
+
input.push(reasoningMessages[reasoningId]);
|
|
2188
2197
|
} else {
|
|
2189
|
-
|
|
2190
|
-
if (part.text.length > 0) {
|
|
2191
|
-
summaryParts.push({
|
|
2192
|
-
type: "summary_text",
|
|
2193
|
-
text: part.text
|
|
2194
|
-
});
|
|
2195
|
-
} else if (reasoningMessage !== void 0) {
|
|
2196
|
-
warnings.push({
|
|
2197
|
-
type: "other",
|
|
2198
|
-
message: `Cannot append empty reasoning part to existing reasoning sequence. Skipping reasoning part: ${JSON.stringify(part)}.`
|
|
2199
|
-
});
|
|
2200
|
-
}
|
|
2201
|
-
if (reasoningMessage === void 0) {
|
|
2202
|
-
reasoningMessages[reasoningId] = {
|
|
2203
|
-
type: "reasoning",
|
|
2204
|
-
id: reasoningId,
|
|
2205
|
-
encrypted_content: providerOptions == null ? void 0 : providerOptions.reasoningEncryptedContent,
|
|
2206
|
-
summary: summaryParts
|
|
2207
|
-
};
|
|
2208
|
-
input.push(reasoningMessages[reasoningId]);
|
|
2209
|
-
} else {
|
|
2210
|
-
reasoningMessage.summary.push(...summaryParts);
|
|
2211
|
-
}
|
|
2198
|
+
existingReasoningMessage.summary.push(...summaryParts);
|
|
2212
2199
|
}
|
|
2213
2200
|
} else {
|
|
2214
2201
|
warnings.push({
|
|
@@ -2310,9 +2297,6 @@ var codeInterpreterToolFactory = createProviderDefinedToolFactoryWithOutputSchem
|
|
|
2310
2297
|
inputSchema: codeInterpreterInputSchema,
|
|
2311
2298
|
outputSchema: codeInterpreterOutputSchema
|
|
2312
2299
|
});
|
|
2313
|
-
var codeInterpreter = (args = {}) => {
|
|
2314
|
-
return codeInterpreterToolFactory(args);
|
|
2315
|
-
};
|
|
2316
2300
|
|
|
2317
2301
|
// src/tool/file-search.ts
|
|
2318
2302
|
import { createProviderDefinedToolFactoryWithOutputSchema as createProviderDefinedToolFactoryWithOutputSchema2 } from "@ai-sdk/provider-utils";
|
|
@@ -2963,7 +2947,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
2963
2947
|
])
|
|
2964
2948
|
),
|
|
2965
2949
|
service_tier: z18.string().nullish(),
|
|
2966
|
-
incomplete_details: z18.object({ reason: z18.string() }).
|
|
2950
|
+
incomplete_details: z18.object({ reason: z18.string() }).nullable(),
|
|
2967
2951
|
usage: usageSchema2
|
|
2968
2952
|
})
|
|
2969
2953
|
),
|
|
@@ -3849,19 +3833,11 @@ export {
|
|
|
3849
3833
|
OpenAIResponsesLanguageModel,
|
|
3850
3834
|
OpenAISpeechModel,
|
|
3851
3835
|
OpenAITranscriptionModel,
|
|
3852
|
-
codeInterpreter,
|
|
3853
|
-
codeInterpreterArgsSchema,
|
|
3854
|
-
codeInterpreterInputSchema,
|
|
3855
|
-
codeInterpreterOutputSchema,
|
|
3856
|
-
codeInterpreterToolFactory,
|
|
3857
|
-
fileSearch,
|
|
3858
|
-
fileSearchArgsSchema,
|
|
3859
|
-
fileSearchOutputSchema,
|
|
3860
3836
|
hasDefaultResponseFormat,
|
|
3861
3837
|
modelMaxImagesPerCall,
|
|
3862
3838
|
openAITranscriptionProviderOptions,
|
|
3863
|
-
openaiChatLanguageModelOptions,
|
|
3864
3839
|
openaiCompletionProviderOptions,
|
|
3865
|
-
openaiEmbeddingProviderOptions
|
|
3840
|
+
openaiEmbeddingProviderOptions,
|
|
3841
|
+
openaiProviderOptions
|
|
3866
3842
|
};
|
|
3867
3843
|
//# sourceMappingURL=index.mjs.map
|