@ai-sdk/openai 2.0.32 → 2.0.34
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 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +19 -11
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +20 -12
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.js +1 -1
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +1 -1
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @ai-sdk/openai
|
|
2
2
|
|
|
3
|
+
## 2.0.34
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 322901b: feat: add provider version to user-agent header
|
|
8
|
+
|
|
9
|
+
## 2.0.33
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- a617948: fix the "incomplete_details" key from nullable to nullish for openai compatibility
|
|
14
|
+
|
|
3
15
|
## 2.0.32
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
package/dist/index.d.mts
CHANGED
|
@@ -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
|
@@ -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
|
});
|
|
@@ -2657,7 +2658,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
2657
2658
|
])
|
|
2658
2659
|
),
|
|
2659
2660
|
service_tier: import_v415.z.string().nullish(),
|
|
2660
|
-
incomplete_details: import_v415.z.object({ reason: import_v415.z.string() }).
|
|
2661
|
+
incomplete_details: import_v415.z.object({ reason: import_v415.z.string() }).nullish(),
|
|
2661
2662
|
usage: usageSchema2
|
|
2662
2663
|
})
|
|
2663
2664
|
),
|
|
@@ -3867,21 +3868,27 @@ var openaiTranscriptionResponseSchema = import_v418.z.object({
|
|
|
3867
3868
|
).nullish()
|
|
3868
3869
|
});
|
|
3869
3870
|
|
|
3871
|
+
// src/version.ts
|
|
3872
|
+
var VERSION = true ? "2.0.34" : "0.0.0-test";
|
|
3873
|
+
|
|
3870
3874
|
// src/openai-provider.ts
|
|
3871
3875
|
function createOpenAI(options = {}) {
|
|
3872
3876
|
var _a, _b;
|
|
3873
3877
|
const baseURL = (_a = (0, import_provider_utils16.withoutTrailingSlash)(options.baseURL)) != null ? _a : "https://api.openai.com/v1";
|
|
3874
3878
|
const providerName = (_b = options.name) != null ? _b : "openai";
|
|
3875
|
-
const getHeaders = () => (
|
|
3876
|
-
|
|
3877
|
-
|
|
3878
|
-
|
|
3879
|
-
|
|
3880
|
-
|
|
3881
|
-
|
|
3882
|
-
|
|
3883
|
-
|
|
3884
|
-
|
|
3879
|
+
const getHeaders = () => (0, import_provider_utils16.withUserAgentSuffix)(
|
|
3880
|
+
{
|
|
3881
|
+
Authorization: `Bearer ${(0, import_provider_utils16.loadApiKey)({
|
|
3882
|
+
apiKey: options.apiKey,
|
|
3883
|
+
environmentVariableName: "OPENAI_API_KEY",
|
|
3884
|
+
description: "OpenAI"
|
|
3885
|
+
})}`,
|
|
3886
|
+
"OpenAI-Organization": options.organization,
|
|
3887
|
+
"OpenAI-Project": options.project,
|
|
3888
|
+
...options.headers
|
|
3889
|
+
},
|
|
3890
|
+
`ai-sdk/openai/${VERSION}`
|
|
3891
|
+
);
|
|
3885
3892
|
const createChatModel = (modelId) => new OpenAIChatLanguageModel(modelId, {
|
|
3886
3893
|
provider: `${providerName}.chat`,
|
|
3887
3894
|
url: ({ path }) => `${baseURL}${path}`,
|
|
@@ -3957,6 +3964,7 @@ function createOpenAI(options = {}) {
|
|
|
3957
3964
|
var openai = createOpenAI();
|
|
3958
3965
|
// Annotate the CommonJS export names for ESM import in node:
|
|
3959
3966
|
0 && (module.exports = {
|
|
3967
|
+
VERSION,
|
|
3960
3968
|
createOpenAI,
|
|
3961
3969
|
openai
|
|
3962
3970
|
});
|