@ai-sdk/openai 2.0.37 → 2.1.0-beta.0
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 +6 -41
- package/dist/index.d.mts +1 -34
- package/dist/index.d.ts +1 -34
- package/dist/index.js +32 -54
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +33 -55
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.d.mts +3 -3
- package/dist/internal/index.d.ts +3 -3
- package/dist/internal/index.js +26 -40
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +24 -38
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +4 -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) {
|
|
@@ -2175,40 +2175,26 @@ async function convertToOpenAIResponsesInput({
|
|
|
2175
2175
|
});
|
|
2176
2176
|
const reasoningId = providerOptions == null ? void 0 : providerOptions.itemId;
|
|
2177
2177
|
if (reasoningId != null) {
|
|
2178
|
-
const
|
|
2179
|
-
|
|
2180
|
-
|
|
2181
|
-
|
|
2182
|
-
|
|
2183
|
-
|
|
2184
|
-
|
|
2185
|
-
|
|
2186
|
-
|
|
2187
|
-
|
|
2178
|
+
const existingReasoningMessage = reasoningMessages[reasoningId];
|
|
2179
|
+
const summaryParts = [];
|
|
2180
|
+
if (part.text.length > 0) {
|
|
2181
|
+
summaryParts.push({ type: "summary_text", text: part.text });
|
|
2182
|
+
} else if (existingReasoningMessage !== void 0) {
|
|
2183
|
+
warnings.push({
|
|
2184
|
+
type: "other",
|
|
2185
|
+
message: `Cannot append empty reasoning part to existing reasoning sequence. Skipping reasoning part: ${JSON.stringify(part)}.`
|
|
2186
|
+
});
|
|
2187
|
+
}
|
|
2188
|
+
if (existingReasoningMessage === void 0) {
|
|
2189
|
+
reasoningMessages[reasoningId] = {
|
|
2190
|
+
type: "reasoning",
|
|
2191
|
+
id: reasoningId,
|
|
2192
|
+
encrypted_content: providerOptions == null ? void 0 : providerOptions.reasoningEncryptedContent,
|
|
2193
|
+
summary: summaryParts
|
|
2194
|
+
};
|
|
2195
|
+
input.push(reasoningMessages[reasoningId]);
|
|
2188
2196
|
} 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
|
-
}
|
|
2197
|
+
existingReasoningMessage.summary.push(...summaryParts);
|
|
2212
2198
|
}
|
|
2213
2199
|
} else {
|
|
2214
2200
|
warnings.push({
|
|
@@ -2960,7 +2946,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
2960
2946
|
])
|
|
2961
2947
|
),
|
|
2962
2948
|
service_tier: z18.string().nullish(),
|
|
2963
|
-
incomplete_details: z18.object({ reason: z18.string() }).
|
|
2949
|
+
incomplete_details: z18.object({ reason: z18.string() }).nullable(),
|
|
2964
2950
|
usage: usageSchema2
|
|
2965
2951
|
})
|
|
2966
2952
|
),
|
|
@@ -3849,8 +3835,8 @@ export {
|
|
|
3849
3835
|
hasDefaultResponseFormat,
|
|
3850
3836
|
modelMaxImagesPerCall,
|
|
3851
3837
|
openAITranscriptionProviderOptions,
|
|
3852
|
-
openaiChatLanguageModelOptions,
|
|
3853
3838
|
openaiCompletionProviderOptions,
|
|
3854
|
-
openaiEmbeddingProviderOptions
|
|
3839
|
+
openaiEmbeddingProviderOptions,
|
|
3840
|
+
openaiProviderOptions
|
|
3855
3841
|
};
|
|
3856
3842
|
//# sourceMappingURL=index.mjs.map
|