@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/dist/index.mjs
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
// src/openai-provider.ts
|
|
2
2
|
import {
|
|
3
3
|
loadApiKey,
|
|
4
|
-
withoutTrailingSlash
|
|
4
|
+
withoutTrailingSlash,
|
|
5
|
+
withUserAgentSuffix
|
|
5
6
|
} from "@ai-sdk/provider-utils";
|
|
6
7
|
|
|
7
8
|
// src/chat/openai-chat-language-model.ts
|
|
@@ -2680,7 +2681,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
2680
2681
|
])
|
|
2681
2682
|
),
|
|
2682
2683
|
service_tier: z15.string().nullish(),
|
|
2683
|
-
incomplete_details: z15.object({ reason: z15.string() }).
|
|
2684
|
+
incomplete_details: z15.object({ reason: z15.string() }).nullish(),
|
|
2684
2685
|
usage: usageSchema2
|
|
2685
2686
|
})
|
|
2686
2687
|
),
|
|
@@ -3902,21 +3903,27 @@ var openaiTranscriptionResponseSchema = z18.object({
|
|
|
3902
3903
|
).nullish()
|
|
3903
3904
|
});
|
|
3904
3905
|
|
|
3906
|
+
// src/version.ts
|
|
3907
|
+
var VERSION = true ? "2.0.34" : "0.0.0-test";
|
|
3908
|
+
|
|
3905
3909
|
// src/openai-provider.ts
|
|
3906
3910
|
function createOpenAI(options = {}) {
|
|
3907
3911
|
var _a, _b;
|
|
3908
3912
|
const baseURL = (_a = withoutTrailingSlash(options.baseURL)) != null ? _a : "https://api.openai.com/v1";
|
|
3909
3913
|
const providerName = (_b = options.name) != null ? _b : "openai";
|
|
3910
|
-
const getHeaders = () => (
|
|
3911
|
-
|
|
3912
|
-
|
|
3913
|
-
|
|
3914
|
-
|
|
3915
|
-
|
|
3916
|
-
|
|
3917
|
-
|
|
3918
|
-
|
|
3919
|
-
|
|
3914
|
+
const getHeaders = () => withUserAgentSuffix(
|
|
3915
|
+
{
|
|
3916
|
+
Authorization: `Bearer ${loadApiKey({
|
|
3917
|
+
apiKey: options.apiKey,
|
|
3918
|
+
environmentVariableName: "OPENAI_API_KEY",
|
|
3919
|
+
description: "OpenAI"
|
|
3920
|
+
})}`,
|
|
3921
|
+
"OpenAI-Organization": options.organization,
|
|
3922
|
+
"OpenAI-Project": options.project,
|
|
3923
|
+
...options.headers
|
|
3924
|
+
},
|
|
3925
|
+
`ai-sdk/openai/${VERSION}`
|
|
3926
|
+
);
|
|
3920
3927
|
const createChatModel = (modelId) => new OpenAIChatLanguageModel(modelId, {
|
|
3921
3928
|
provider: `${providerName}.chat`,
|
|
3922
3929
|
url: ({ path }) => `${baseURL}${path}`,
|
|
@@ -3991,6 +3998,7 @@ function createOpenAI(options = {}) {
|
|
|
3991
3998
|
}
|
|
3992
3999
|
var openai = createOpenAI();
|
|
3993
4000
|
export {
|
|
4001
|
+
VERSION,
|
|
3994
4002
|
createOpenAI,
|
|
3995
4003
|
openai
|
|
3996
4004
|
};
|