@ai-sdk/openai 2.1.0-beta.1 → 2.1.0-beta.2
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 -0
- package/dist/index.d.mts +7 -5
- package/dist/index.d.ts +7 -5
- package/dist/index.js +20 -12
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +21 -13
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.d.mts +4 -4
- package/dist/internal/index.d.ts +4 -4
- package/dist/internal/index.js +2 -2
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +2 -2
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# @ai-sdk/openai
|
|
2
2
|
|
|
3
|
+
## 2.1.0-beta.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 4920119: fix the "incomplete_details" key from nullable to nullish for openai compatibility
|
|
8
|
+
- 0c4822d: feat: `EmbeddingModelV3`
|
|
9
|
+
- 1cad0ab: feat: add provider version to user-agent header
|
|
10
|
+
- Updated dependencies [0c4822d]
|
|
11
|
+
- @ai-sdk/provider@2.1.0-beta.1
|
|
12
|
+
- @ai-sdk/provider-utils@3.1.0-beta.2
|
|
13
|
+
|
|
3
14
|
## 2.1.0-beta.1
|
|
4
15
|
|
|
5
16
|
### Patch Changes
|
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ProviderV2, LanguageModelV2,
|
|
1
|
+
import { ProviderV2, LanguageModelV2, EmbeddingModelV3, ImageModelV2, TranscriptionModelV2, SpeechModelV2 } 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';
|
|
@@ -234,15 +234,15 @@ interface OpenAIProvider extends ProviderV2 {
|
|
|
234
234
|
/**
|
|
235
235
|
Creates a model for text embeddings.
|
|
236
236
|
*/
|
|
237
|
-
embedding(modelId: OpenAIEmbeddingModelId):
|
|
237
|
+
embedding(modelId: OpenAIEmbeddingModelId): EmbeddingModelV3<string>;
|
|
238
238
|
/**
|
|
239
239
|
Creates a model for text embeddings.
|
|
240
240
|
*/
|
|
241
|
-
textEmbedding(modelId: OpenAIEmbeddingModelId):
|
|
241
|
+
textEmbedding(modelId: OpenAIEmbeddingModelId): EmbeddingModelV3<string>;
|
|
242
242
|
/**
|
|
243
243
|
Creates a model for text embeddings.
|
|
244
244
|
*/
|
|
245
|
-
textEmbeddingModel(modelId: OpenAIEmbeddingModelId):
|
|
245
|
+
textEmbeddingModel(modelId: OpenAIEmbeddingModelId): EmbeddingModelV3<string>;
|
|
246
246
|
/**
|
|
247
247
|
Creates a model for image generation.
|
|
248
248
|
*/
|
|
@@ -336,4 +336,6 @@ declare const openaiResponsesProviderOptionsSchema: z.ZodObject<{
|
|
|
336
336
|
}, z.core.$strip>;
|
|
337
337
|
type OpenAIResponsesProviderOptions = z.infer<typeof openaiResponsesProviderOptionsSchema>;
|
|
338
338
|
|
|
339
|
-
|
|
339
|
+
declare const VERSION: string;
|
|
340
|
+
|
|
341
|
+
export { type OpenAIProvider, type OpenAIProviderSettings, type OpenAIResponsesProviderOptions, VERSION, createOpenAI, openai };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ProviderV2, LanguageModelV2,
|
|
1
|
+
import { ProviderV2, LanguageModelV2, EmbeddingModelV3, ImageModelV2, TranscriptionModelV2, SpeechModelV2 } 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';
|
|
@@ -234,15 +234,15 @@ interface OpenAIProvider extends ProviderV2 {
|
|
|
234
234
|
/**
|
|
235
235
|
Creates a model for text embeddings.
|
|
236
236
|
*/
|
|
237
|
-
embedding(modelId: OpenAIEmbeddingModelId):
|
|
237
|
+
embedding(modelId: OpenAIEmbeddingModelId): EmbeddingModelV3<string>;
|
|
238
238
|
/**
|
|
239
239
|
Creates a model for text embeddings.
|
|
240
240
|
*/
|
|
241
|
-
textEmbedding(modelId: OpenAIEmbeddingModelId):
|
|
241
|
+
textEmbedding(modelId: OpenAIEmbeddingModelId): EmbeddingModelV3<string>;
|
|
242
242
|
/**
|
|
243
243
|
Creates a model for text embeddings.
|
|
244
244
|
*/
|
|
245
|
-
textEmbeddingModel(modelId: OpenAIEmbeddingModelId):
|
|
245
|
+
textEmbeddingModel(modelId: OpenAIEmbeddingModelId): EmbeddingModelV3<string>;
|
|
246
246
|
/**
|
|
247
247
|
Creates a model for image generation.
|
|
248
248
|
*/
|
|
@@ -336,4 +336,6 @@ declare const openaiResponsesProviderOptionsSchema: z.ZodObject<{
|
|
|
336
336
|
}, z.core.$strip>;
|
|
337
337
|
type OpenAIResponsesProviderOptions = z.infer<typeof openaiResponsesProviderOptionsSchema>;
|
|
338
338
|
|
|
339
|
-
|
|
339
|
+
declare const VERSION: string;
|
|
340
|
+
|
|
341
|
+
export { type OpenAIProvider, type OpenAIProviderSettings, type OpenAIResponsesProviderOptions, VERSION, createOpenAI, openai };
|
package/dist/index.js
CHANGED
|
@@ -20,6 +20,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
20
20
|
// src/index.ts
|
|
21
21
|
var src_exports = {};
|
|
22
22
|
__export(src_exports, {
|
|
23
|
+
VERSION: () => VERSION,
|
|
23
24
|
createOpenAI: () => createOpenAI,
|
|
24
25
|
openai: () => openai
|
|
25
26
|
});
|
|
@@ -1516,7 +1517,7 @@ var openaiEmbeddingProviderOptions = import_v46.z.object({
|
|
|
1516
1517
|
// src/embedding/openai-embedding-model.ts
|
|
1517
1518
|
var OpenAIEmbeddingModel = class {
|
|
1518
1519
|
constructor(modelId, config) {
|
|
1519
|
-
this.specificationVersion = "
|
|
1520
|
+
this.specificationVersion = "v3";
|
|
1520
1521
|
this.maxEmbeddingsPerCall = 2048;
|
|
1521
1522
|
this.supportsParallelCalls = true;
|
|
1522
1523
|
this.modelId = modelId;
|
|
@@ -2658,7 +2659,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
2658
2659
|
])
|
|
2659
2660
|
),
|
|
2660
2661
|
service_tier: import_v415.z.string().nullish(),
|
|
2661
|
-
incomplete_details: import_v415.z.object({ reason: import_v415.z.string() }).
|
|
2662
|
+
incomplete_details: import_v415.z.object({ reason: import_v415.z.string() }).nullish(),
|
|
2662
2663
|
usage: usageSchema2
|
|
2663
2664
|
})
|
|
2664
2665
|
),
|
|
@@ -3868,21 +3869,27 @@ var openaiTranscriptionResponseSchema = import_v418.z.object({
|
|
|
3868
3869
|
).nullish()
|
|
3869
3870
|
});
|
|
3870
3871
|
|
|
3872
|
+
// src/version.ts
|
|
3873
|
+
var VERSION = true ? "2.1.0-beta.2" : "0.0.0-test";
|
|
3874
|
+
|
|
3871
3875
|
// src/openai-provider.ts
|
|
3872
3876
|
function createOpenAI(options = {}) {
|
|
3873
3877
|
var _a, _b;
|
|
3874
3878
|
const baseURL = (_a = (0, import_provider_utils16.withoutTrailingSlash)(options.baseURL)) != null ? _a : "https://api.openai.com/v1";
|
|
3875
3879
|
const providerName = (_b = options.name) != null ? _b : "openai";
|
|
3876
|
-
const getHeaders = () => (
|
|
3877
|
-
|
|
3878
|
-
|
|
3879
|
-
|
|
3880
|
-
|
|
3881
|
-
|
|
3882
|
-
|
|
3883
|
-
|
|
3884
|
-
|
|
3885
|
-
|
|
3880
|
+
const getHeaders = () => (0, import_provider_utils16.withUserAgentSuffix)(
|
|
3881
|
+
{
|
|
3882
|
+
Authorization: `Bearer ${(0, import_provider_utils16.loadApiKey)({
|
|
3883
|
+
apiKey: options.apiKey,
|
|
3884
|
+
environmentVariableName: "OPENAI_API_KEY",
|
|
3885
|
+
description: "OpenAI"
|
|
3886
|
+
})}`,
|
|
3887
|
+
"OpenAI-Organization": options.organization,
|
|
3888
|
+
"OpenAI-Project": options.project,
|
|
3889
|
+
...options.headers
|
|
3890
|
+
},
|
|
3891
|
+
`ai-sdk/openai/${VERSION}`
|
|
3892
|
+
);
|
|
3886
3893
|
const createChatModel = (modelId) => new OpenAIChatLanguageModel(modelId, {
|
|
3887
3894
|
provider: `${providerName}.chat`,
|
|
3888
3895
|
url: ({ path }) => `${baseURL}${path}`,
|
|
@@ -3958,6 +3965,7 @@ function createOpenAI(options = {}) {
|
|
|
3958
3965
|
var openai = createOpenAI();
|
|
3959
3966
|
// Annotate the CommonJS export names for ESM import in node:
|
|
3960
3967
|
0 && (module.exports = {
|
|
3968
|
+
VERSION,
|
|
3961
3969
|
createOpenAI,
|
|
3962
3970
|
openai
|
|
3963
3971
|
});
|