@ai-sdk/openai 2.1.0-beta.11 → 2.1.0-beta.12
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 +12 -0
- package/dist/index.d.mts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +13 -6
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +13 -6
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.d.mts +8 -8
- package/dist/internal/index.d.ts +8 -8
- package/dist/internal/index.js +12 -5
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +12 -5
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @ai-sdk/openai
|
|
2
2
|
|
|
3
|
+
## 2.1.0-beta.12
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 046aa3b: feat(provider): speech model v3 spec
|
|
8
|
+
- e8109d3: feat: tool execution approval
|
|
9
|
+
- 21e20c0: feat(provider): transcription model v3 spec
|
|
10
|
+
- Updated dependencies [046aa3b]
|
|
11
|
+
- Updated dependencies [e8109d3]
|
|
12
|
+
- @ai-sdk/provider@2.1.0-beta.5
|
|
13
|
+
- @ai-sdk/provider-utils@3.1.0-beta.7
|
|
14
|
+
|
|
3
15
|
## 2.1.0-beta.11
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ProviderV3, LanguageModelV3, EmbeddingModelV3, ImageModelV3,
|
|
1
|
+
import { ProviderV3, LanguageModelV3, EmbeddingModelV3, ImageModelV3, TranscriptionModelV3, SpeechModelV3 } from '@ai-sdk/provider';
|
|
2
2
|
import * as _ai_sdk_provider_utils from '@ai-sdk/provider-utils';
|
|
3
3
|
import { FetchFunction } from '@ai-sdk/provider-utils';
|
|
4
4
|
import { z } from 'zod/v4';
|
|
@@ -311,11 +311,11 @@ interface OpenAIProvider extends ProviderV3 {
|
|
|
311
311
|
/**
|
|
312
312
|
Creates a model for transcription.
|
|
313
313
|
*/
|
|
314
|
-
transcription(modelId: OpenAITranscriptionModelId):
|
|
314
|
+
transcription(modelId: OpenAITranscriptionModelId): TranscriptionModelV3;
|
|
315
315
|
/**
|
|
316
316
|
Creates a model for speech generation.
|
|
317
317
|
*/
|
|
318
|
-
speech(modelId: OpenAISpeechModelId):
|
|
318
|
+
speech(modelId: OpenAISpeechModelId): SpeechModelV3;
|
|
319
319
|
/**
|
|
320
320
|
OpenAI-specific tools.
|
|
321
321
|
*/
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ProviderV3, LanguageModelV3, EmbeddingModelV3, ImageModelV3,
|
|
1
|
+
import { ProviderV3, LanguageModelV3, EmbeddingModelV3, ImageModelV3, TranscriptionModelV3, SpeechModelV3 } from '@ai-sdk/provider';
|
|
2
2
|
import * as _ai_sdk_provider_utils from '@ai-sdk/provider-utils';
|
|
3
3
|
import { FetchFunction } from '@ai-sdk/provider-utils';
|
|
4
4
|
import { z } from 'zod/v4';
|
|
@@ -311,11 +311,11 @@ interface OpenAIProvider extends ProviderV3 {
|
|
|
311
311
|
/**
|
|
312
312
|
Creates a model for transcription.
|
|
313
313
|
*/
|
|
314
|
-
transcription(modelId: OpenAITranscriptionModelId):
|
|
314
|
+
transcription(modelId: OpenAITranscriptionModelId): TranscriptionModelV3;
|
|
315
315
|
/**
|
|
316
316
|
Creates a model for speech generation.
|
|
317
317
|
*/
|
|
318
|
-
speech(modelId: OpenAISpeechModelId):
|
|
318
|
+
speech(modelId: OpenAISpeechModelId): SpeechModelV3;
|
|
319
319
|
/**
|
|
320
320
|
OpenAI-specific tools.
|
|
321
321
|
*/
|
package/dist/index.js
CHANGED
|
@@ -60,6 +60,7 @@ function convertToOpenAIChatMessages({
|
|
|
60
60
|
prompt,
|
|
61
61
|
systemMessageMode = "system"
|
|
62
62
|
}) {
|
|
63
|
+
var _a;
|
|
63
64
|
const messages = [];
|
|
64
65
|
const warnings = [];
|
|
65
66
|
for (const { role, content } of prompt) {
|
|
@@ -98,7 +99,7 @@ function convertToOpenAIChatMessages({
|
|
|
98
99
|
messages.push({
|
|
99
100
|
role: "user",
|
|
100
101
|
content: content.map((part, index) => {
|
|
101
|
-
var
|
|
102
|
+
var _a2, _b, _c;
|
|
102
103
|
switch (part.type) {
|
|
103
104
|
case "text": {
|
|
104
105
|
return { type: "text", text: part.text };
|
|
@@ -111,7 +112,7 @@ function convertToOpenAIChatMessages({
|
|
|
111
112
|
image_url: {
|
|
112
113
|
url: part.data instanceof URL ? part.data.toString() : `data:${mediaType};base64,${(0, import_provider_utils2.convertToBase64)(part.data)}`,
|
|
113
114
|
// OpenAI specific extension: image detail
|
|
114
|
-
detail: (_b = (
|
|
115
|
+
detail: (_b = (_a2 = part.providerOptions) == null ? void 0 : _a2.openai) == null ? void 0 : _b.imageDetail
|
|
115
116
|
}
|
|
116
117
|
};
|
|
117
118
|
} else if (part.mediaType.startsWith("audio/")) {
|
|
@@ -208,6 +209,9 @@ function convertToOpenAIChatMessages({
|
|
|
208
209
|
case "error-text":
|
|
209
210
|
contentValue = output.value;
|
|
210
211
|
break;
|
|
212
|
+
case "execution-denied":
|
|
213
|
+
contentValue = (_a = output.reason) != null ? _a : "Tool execution denied.";
|
|
214
|
+
break;
|
|
211
215
|
case "content":
|
|
212
216
|
case "json":
|
|
213
217
|
case "error-json":
|
|
@@ -2005,7 +2009,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
2005
2009
|
store,
|
|
2006
2010
|
hasLocalShellTool = false
|
|
2007
2011
|
}) {
|
|
2008
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
2012
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
2009
2013
|
const input = [];
|
|
2010
2014
|
const warnings = [];
|
|
2011
2015
|
for (const { role, content } of prompt) {
|
|
@@ -2208,6 +2212,9 @@ async function convertToOpenAIResponsesInput({
|
|
|
2208
2212
|
case "error-text":
|
|
2209
2213
|
contentValue = output.value;
|
|
2210
2214
|
break;
|
|
2215
|
+
case "execution-denied":
|
|
2216
|
+
contentValue = (_j = output.reason) != null ? _j : "Tool execution denied.";
|
|
2217
|
+
break;
|
|
2211
2218
|
case "content":
|
|
2212
2219
|
case "json":
|
|
2213
2220
|
case "error-json":
|
|
@@ -3781,7 +3788,7 @@ var OpenAISpeechModel = class {
|
|
|
3781
3788
|
constructor(modelId, config) {
|
|
3782
3789
|
this.modelId = modelId;
|
|
3783
3790
|
this.config = config;
|
|
3784
|
-
this.specificationVersion = "
|
|
3791
|
+
this.specificationVersion = "v3";
|
|
3785
3792
|
}
|
|
3786
3793
|
get provider() {
|
|
3787
3794
|
return this.config.provider;
|
|
@@ -3972,7 +3979,7 @@ var OpenAITranscriptionModel = class {
|
|
|
3972
3979
|
constructor(modelId, config) {
|
|
3973
3980
|
this.modelId = modelId;
|
|
3974
3981
|
this.config = config;
|
|
3975
|
-
this.specificationVersion = "
|
|
3982
|
+
this.specificationVersion = "v3";
|
|
3976
3983
|
}
|
|
3977
3984
|
get provider() {
|
|
3978
3985
|
return this.config.provider;
|
|
@@ -4102,7 +4109,7 @@ var openaiTranscriptionResponseSchema = import_v419.z.object({
|
|
|
4102
4109
|
});
|
|
4103
4110
|
|
|
4104
4111
|
// src/version.ts
|
|
4105
|
-
var VERSION = true ? "2.1.0-beta.
|
|
4112
|
+
var VERSION = true ? "2.1.0-beta.12" : "0.0.0-test";
|
|
4106
4113
|
|
|
4107
4114
|
// src/openai-provider.ts
|
|
4108
4115
|
function createOpenAI(options = {}) {
|