@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/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 = "v2";
1526
+ this.specificationVersion = "v3";
1526
1527
  this.maxEmbeddingsPerCall = 2048;
1527
1528
  this.supportsParallelCalls = true;
1528
1529
  this.modelId = modelId;
@@ -2681,7 +2682,7 @@ var OpenAIResponsesLanguageModel = class {
2681
2682
  ])
2682
2683
  ),
2683
2684
  service_tier: z15.string().nullish(),
2684
- incomplete_details: z15.object({ reason: z15.string() }).nullable(),
2685
+ incomplete_details: z15.object({ reason: z15.string() }).nullish(),
2685
2686
  usage: usageSchema2
2686
2687
  })
2687
2688
  ),
@@ -3903,21 +3904,27 @@ var openaiTranscriptionResponseSchema = z18.object({
3903
3904
  ).nullish()
3904
3905
  });
3905
3906
 
3907
+ // src/version.ts
3908
+ var VERSION = true ? "2.1.0-beta.2" : "0.0.0-test";
3909
+
3906
3910
  // src/openai-provider.ts
3907
3911
  function createOpenAI(options = {}) {
3908
3912
  var _a, _b;
3909
3913
  const baseURL = (_a = withoutTrailingSlash(options.baseURL)) != null ? _a : "https://api.openai.com/v1";
3910
3914
  const providerName = (_b = options.name) != null ? _b : "openai";
3911
- const getHeaders = () => ({
3912
- Authorization: `Bearer ${loadApiKey({
3913
- apiKey: options.apiKey,
3914
- environmentVariableName: "OPENAI_API_KEY",
3915
- description: "OpenAI"
3916
- })}`,
3917
- "OpenAI-Organization": options.organization,
3918
- "OpenAI-Project": options.project,
3919
- ...options.headers
3920
- });
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
+ );
3921
3928
  const createChatModel = (modelId) => new OpenAIChatLanguageModel(modelId, {
3922
3929
  provider: `${providerName}.chat`,
3923
3930
  url: ({ path }) => `${baseURL}${path}`,
@@ -3992,6 +3999,7 @@ function createOpenAI(options = {}) {
3992
3999
  }
3993
4000
  var openai = createOpenAI();
3994
4001
  export {
4002
+ VERSION,
3995
4003
  createOpenAI,
3996
4004
  openai
3997
4005
  };