@ai-sdk/openai 4.0.89 → 4.0.91
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 +17 -0
- package/dist/index.js +22 -9
- package/dist/index.js.map +1 -1
- package/dist/internal/index.d.ts +1 -1
- package/dist/internal/index.d.ts.map +1 -1
- package/dist/internal/index.js +14 -6
- package/dist/internal/index.js.map +1 -1
- package/docs/03-openai.mdx +16 -0
- package/package.json +3 -3
- package/src/chat/openai-chat-language-model.ts +1 -1
- package/src/embedding/openai-embedding-model.ts +2 -1
- package/src/openai-batch.ts +3 -1
- package/src/openai-decision-model.ts +2 -0
- package/src/openai-language-model-capabilities.ts +7 -5
- package/src/responses/openai-responses-language-model.ts +17 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# @ai-sdk/openai
|
|
2
2
|
|
|
3
|
+
## 4.0.91
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 5cf13d2: feat: map the top level embedding dimensions to provider settings
|
|
8
|
+
- 72e9d38: feat(openai): send image detail in decisions
|
|
9
|
+
- fb933f9: Report failed and incomplete web searches as tool errors instead of successful tool results in OpenAI Responses API calls and batch results.
|
|
10
|
+
- Updated dependencies [4dbc902]
|
|
11
|
+
- @ai-sdk/provider@4.0.26
|
|
12
|
+
- @ai-sdk/provider-utils@5.0.58
|
|
13
|
+
|
|
14
|
+
## 4.0.90
|
|
15
|
+
|
|
16
|
+
### Patch Changes
|
|
17
|
+
|
|
18
|
+
- 6c59fb1: fix(openai): preserve sampling parameters for GPT-6 Sol and Luna when reasoning is disabled, accounting for reasoning effort updates in Responses requests
|
|
19
|
+
|
|
3
20
|
## 4.0.89
|
|
4
21
|
|
|
5
22
|
### Patch Changes
|
package/dist/index.js
CHANGED
|
@@ -142,9 +142,11 @@ var DecisionOpenAIModel = class DecisionOpenAIModel {
|
|
|
142
142
|
"image/webp",
|
|
143
143
|
"image/gif"
|
|
144
144
|
].includes(mediaType ?? "")) throw new UnsupportedFunctionalityError({ functionality: `OpenAI decision image media type: ${part.mediaType}` });
|
|
145
|
+
const detail = part.providerOptions?.openai?.imageDetail;
|
|
145
146
|
return {
|
|
146
147
|
type: "input_image",
|
|
147
|
-
image_url: `data:${mediaType};base64,${typeof part.data.data === "string" ? part.data.data : convertUint8ArrayToBase64(part.data.data)}
|
|
148
|
+
image_url: `data:${mediaType};base64,${typeof part.data.data === "string" ? part.data.data : convertUint8ArrayToBase64(part.data.data)}`,
|
|
149
|
+
...detail != null && { detail }
|
|
148
150
|
};
|
|
149
151
|
})
|
|
150
152
|
}],
|
|
@@ -259,7 +261,7 @@ function getOpenAILanguageModelCapabilities(modelId) {
|
|
|
259
261
|
const supportsFlexProcessing = oSeriesVersion != null && oSeriesVersion >= 3 || gptVersion != null && gptVersion.major >= 5 && !isGptChatModel;
|
|
260
262
|
const supportsPriorityProcessing = modelId.startsWith("gpt-4") || gptVersion != null && gptVersion.major >= 5 && !isGptNanoModel && !isGptChatModel || oSeriesVersion != null && oSeriesVersion >= 3;
|
|
261
263
|
const isReasoningModel = oSeriesVersion != null || gptVersion != null && gptVersion.major >= 5 && !isGptChatModel;
|
|
262
|
-
const supportsNonReasoningParameters = !isGpt6OrLaterModel && gptVersion != null && (gptVersion.major > 5 || gptVersion.major === 5 && (gptVersion.minor ?? 0) >= 1);
|
|
264
|
+
const supportsNonReasoningParameters = isGpt6SolOrLuna || !isGpt6OrLaterModel && gptVersion != null && (gptVersion.major > 5 || gptVersion.major === 5 && (gptVersion.minor ?? 0) >= 1);
|
|
263
265
|
return {
|
|
264
266
|
supportsFlexProcessing,
|
|
265
267
|
supportsPriorityProcessing,
|
|
@@ -1978,7 +1980,7 @@ var OpenAIEmbeddingModel = class OpenAIEmbeddingModel {
|
|
|
1978
1980
|
this.modelId = modelId;
|
|
1979
1981
|
this.config = config;
|
|
1980
1982
|
}
|
|
1981
|
-
async doEmbed({ values, headers, abortSignal, providerOptions }) {
|
|
1983
|
+
async doEmbed({ values, dimensions, headers, abortSignal, providerOptions }) {
|
|
1982
1984
|
if (values.length > this.maxEmbeddingsPerCall) throw new TooManyEmbeddingValuesForCallError({
|
|
1983
1985
|
provider: this.provider,
|
|
1984
1986
|
modelId: this.modelId,
|
|
@@ -2000,7 +2002,7 @@ var OpenAIEmbeddingModel = class OpenAIEmbeddingModel {
|
|
|
2000
2002
|
model: this.modelId,
|
|
2001
2003
|
input: values,
|
|
2002
2004
|
encoding_format: "float",
|
|
2003
|
-
dimensions: openaiOptions.dimensions,
|
|
2005
|
+
dimensions: openaiOptions.dimensions ?? dimensions,
|
|
2004
2006
|
user: openaiOptions.user
|
|
2005
2007
|
},
|
|
2006
2008
|
failedResponseHandler: openaiFailedResponseHandler,
|
|
@@ -6285,7 +6287,9 @@ var OpenAIResponsesLanguageModel = class OpenAIResponsesLanguageModel {
|
|
|
6285
6287
|
});
|
|
6286
6288
|
}
|
|
6287
6289
|
if (isReasoningModel) {
|
|
6288
|
-
|
|
6290
|
+
let effectiveReasoningEffort = resolvedReasoningEffort;
|
|
6291
|
+
for (const item of input) if (item.type === "configuration_update") effectiveReasoningEffort = item.reasoning.effort;
|
|
6292
|
+
if (!(effectiveReasoningEffort === "none" && modelCapabilities.supportsNonReasoningParameters)) {
|
|
6289
6293
|
if (baseArgs.temperature != null) {
|
|
6290
6294
|
baseArgs.temperature = void 0;
|
|
6291
6295
|
warnings.push({
|
|
@@ -6654,7 +6658,10 @@ var OpenAIResponsesLanguageModel = class OpenAIResponsesLanguageModel {
|
|
|
6654
6658
|
type: "tool-result",
|
|
6655
6659
|
toolCallId: part.id,
|
|
6656
6660
|
toolName: toolNameMapping.toCustomToolName(webSearchToolName ?? "web_search"),
|
|
6657
|
-
|
|
6661
|
+
...part.status === "failed" || part.status === "incomplete" ? {
|
|
6662
|
+
isError: true,
|
|
6663
|
+
result: { status: part.status }
|
|
6664
|
+
} : { result: mapWebSearchOutput(part.action) }
|
|
6658
6665
|
});
|
|
6659
6666
|
break;
|
|
6660
6667
|
case "mcp_call": {
|
|
@@ -7234,7 +7241,10 @@ var OpenAIResponsesLanguageModel = class OpenAIResponsesLanguageModel {
|
|
|
7234
7241
|
type: "tool-result",
|
|
7235
7242
|
toolCallId: value.item.id,
|
|
7236
7243
|
toolName: toolNameMapping.toCustomToolName(webSearchToolName ?? "web_search"),
|
|
7237
|
-
|
|
7244
|
+
...value.item.status === "failed" || value.item.status === "incomplete" ? {
|
|
7245
|
+
isError: true,
|
|
7246
|
+
result: { status: value.item.status }
|
|
7247
|
+
} : { result: mapWebSearchOutput(value.item.action) }
|
|
7238
7248
|
});
|
|
7239
7249
|
} else if (value.item.type === "computer_call") {
|
|
7240
7250
|
ongoingToolCalls[value.output_index] = void 0;
|
|
@@ -8367,7 +8377,10 @@ async function convertOpenAIBatchResult(body) {
|
|
|
8367
8377
|
type: "tool-result",
|
|
8368
8378
|
toolCallId: part.id,
|
|
8369
8379
|
toolName: "web_search",
|
|
8370
|
-
|
|
8380
|
+
...part.status === "failed" || part.status === "incomplete" ? {
|
|
8381
|
+
isError: true,
|
|
8382
|
+
result: { status: part.status }
|
|
8383
|
+
} : { result: mapWebSearchOutput(part.action) },
|
|
8371
8384
|
dynamic: true
|
|
8372
8385
|
});
|
|
8373
8386
|
break;
|
|
@@ -10073,7 +10086,7 @@ var OpenAISkills = class {
|
|
|
10073
10086
|
};
|
|
10074
10087
|
//#endregion
|
|
10075
10088
|
//#region src/version.ts
|
|
10076
|
-
const VERSION = "4.0.
|
|
10089
|
+
const VERSION = "4.0.91";
|
|
10077
10090
|
//#endregion
|
|
10078
10091
|
//#region src/openai-provider.ts
|
|
10079
10092
|
/**
|