@ai-sdk/openai 2.1.0-beta.0 → 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 +20 -0
- package/dist/index.d.mts +7 -5
- package/dist/index.d.ts +7 -5
- package/dist/index.js +21 -12
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +22 -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 +3 -2
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +3 -2
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +4 -3
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
|
|
@@ -1522,7 +1523,7 @@ var openaiEmbeddingProviderOptions = z6.object({
|
|
|
1522
1523
|
// src/embedding/openai-embedding-model.ts
|
|
1523
1524
|
var OpenAIEmbeddingModel = class {
|
|
1524
1525
|
constructor(modelId, config) {
|
|
1525
|
-
this.specificationVersion = "
|
|
1526
|
+
this.specificationVersion = "v3";
|
|
1526
1527
|
this.maxEmbeddingsPerCall = 2048;
|
|
1527
1528
|
this.supportsParallelCalls = true;
|
|
1528
1529
|
this.modelId = modelId;
|
|
@@ -2088,6 +2089,7 @@ async function convertToOpenAIResponsesInput({
|
|
|
2088
2089
|
});
|
|
2089
2090
|
break;
|
|
2090
2091
|
}
|
|
2092
|
+
// assistant tool result parts are from provider-executed tools:
|
|
2091
2093
|
case "tool-result": {
|
|
2092
2094
|
if (store) {
|
|
2093
2095
|
input.push({ type: "item_reference", id: part.toolCallId });
|
|
@@ -2680,7 +2682,7 @@ var OpenAIResponsesLanguageModel = class {
|
|
|
2680
2682
|
])
|
|
2681
2683
|
),
|
|
2682
2684
|
service_tier: z15.string().nullish(),
|
|
2683
|
-
incomplete_details: z15.object({ reason: z15.string() }).
|
|
2685
|
+
incomplete_details: z15.object({ reason: z15.string() }).nullish(),
|
|
2684
2686
|
usage: usageSchema2
|
|
2685
2687
|
})
|
|
2686
2688
|
),
|
|
@@ -3902,21 +3904,27 @@ var openaiTranscriptionResponseSchema = z18.object({
|
|
|
3902
3904
|
).nullish()
|
|
3903
3905
|
});
|
|
3904
3906
|
|
|
3907
|
+
// src/version.ts
|
|
3908
|
+
var VERSION = true ? "2.1.0-beta.2" : "0.0.0-test";
|
|
3909
|
+
|
|
3905
3910
|
// src/openai-provider.ts
|
|
3906
3911
|
function createOpenAI(options = {}) {
|
|
3907
3912
|
var _a, _b;
|
|
3908
3913
|
const baseURL = (_a = withoutTrailingSlash(options.baseURL)) != null ? _a : "https://api.openai.com/v1";
|
|
3909
3914
|
const providerName = (_b = options.name) != null ? _b : "openai";
|
|
3910
|
-
const getHeaders = () => (
|
|
3911
|
-
|
|
3912
|
-
|
|
3913
|
-
|
|
3914
|
-
|
|
3915
|
-
|
|
3916
|
-
|
|
3917
|
-
|
|
3918
|
-
|
|
3919
|
-
|
|
3915
|
+
const getHeaders = () => withUserAgentSuffix(
|
|
3916
|
+
{
|
|
3917
|
+
Authorization: `Bearer ${loadApiKey({
|
|
3918
|
+
apiKey: options.apiKey,
|
|
3919
|
+
environmentVariableName: "OPENAI_API_KEY",
|
|
3920
|
+
description: "OpenAI"
|
|
3921
|
+
})}`,
|
|
3922
|
+
"OpenAI-Organization": options.organization,
|
|
3923
|
+
"OpenAI-Project": options.project,
|
|
3924
|
+
...options.headers
|
|
3925
|
+
},
|
|
3926
|
+
`ai-sdk/openai/${VERSION}`
|
|
3927
|
+
);
|
|
3920
3928
|
const createChatModel = (modelId) => new OpenAIChatLanguageModel(modelId, {
|
|
3921
3929
|
provider: `${providerName}.chat`,
|
|
3922
3930
|
url: ({ path }) => `${baseURL}${path}`,
|
|
@@ -3991,6 +3999,7 @@ function createOpenAI(options = {}) {
|
|
|
3991
3999
|
}
|
|
3992
4000
|
var openai = createOpenAI();
|
|
3993
4001
|
export {
|
|
4002
|
+
VERSION,
|
|
3994
4003
|
createOpenAI,
|
|
3995
4004
|
openai
|
|
3996
4005
|
};
|