@ai-sdk/openai 2.0.0-canary.16 → 2.0.0-canary.18

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
@@ -607,8 +607,9 @@ var OpenAIChatLanguageModel = class {
607
607
  const body = {
608
608
  ...args,
609
609
  stream: true,
610
- // only include stream_options when in strict compatibility mode:
611
- stream_options: this.config.compatibility === "strict" ? { include_usage: true } : void 0
610
+ stream_options: {
611
+ include_usage: true
612
+ }
612
613
  };
613
614
  const { responseHeaders, value: response } = await postJsonToApi({
614
615
  url: this.config.url({
@@ -1193,8 +1194,9 @@ var OpenAICompletionLanguageModel = class {
1193
1194
  const body = {
1194
1195
  ...args,
1195
1196
  stream: true,
1196
- // only include stream_options when in strict compatibility mode:
1197
- stream_options: this.config.compatibility === "strict" ? { include_usage: true } : void 0
1197
+ stream_options: {
1198
+ include_usage: true
1199
+ }
1198
1200
  };
1199
1201
  const { responseHeaders, value: response } = await postJsonToApi2({
1200
1202
  url: this.config.url({
@@ -1434,15 +1436,14 @@ var hasDefaultResponseFormat = /* @__PURE__ */ new Set(["gpt-image-1"]);
1434
1436
 
1435
1437
  // src/openai-image-model.ts
1436
1438
  var OpenAIImageModel = class {
1437
- constructor(modelId, settings, config) {
1439
+ constructor(modelId, config) {
1438
1440
  this.modelId = modelId;
1439
- this.settings = settings;
1440
1441
  this.config = config;
1441
1442
  this.specificationVersion = "v2";
1442
1443
  }
1443
1444
  get maxImagesPerCall() {
1444
- var _a, _b;
1445
- return (_b = (_a = this.settings.maxImagesPerCall) != null ? _a : modelMaxImagesPerCall[this.modelId]) != null ? _b : 1;
1445
+ var _a;
1446
+ return (_a = modelMaxImagesPerCall[this.modelId]) != null ? _a : 1;
1446
1447
  }
1447
1448
  get provider() {
1448
1449
  return this.config.provider;
@@ -2618,10 +2619,9 @@ var OpenAISpeechModel = class {
2618
2619
 
2619
2620
  // src/openai-provider.ts
2620
2621
  function createOpenAI(options = {}) {
2621
- var _a, _b, _c;
2622
+ var _a, _b;
2622
2623
  const baseURL = (_a = withoutTrailingSlash(options.baseURL)) != null ? _a : "https://api.openai.com/v1";
2623
- const compatibility = (_b = options.compatibility) != null ? _b : "compatible";
2624
- const providerName = (_c = options.name) != null ? _c : "openai";
2624
+ const providerName = (_b = options.name) != null ? _b : "openai";
2625
2625
  const getHeaders = () => ({
2626
2626
  Authorization: `Bearer ${loadApiKey({
2627
2627
  apiKey: options.apiKey,
@@ -2636,14 +2636,12 @@ function createOpenAI(options = {}) {
2636
2636
  provider: `${providerName}.chat`,
2637
2637
  url: ({ path }) => `${baseURL}${path}`,
2638
2638
  headers: getHeaders,
2639
- compatibility,
2640
2639
  fetch: options.fetch
2641
2640
  });
2642
2641
  const createCompletionModel = (modelId) => new OpenAICompletionLanguageModel(modelId, {
2643
2642
  provider: `${providerName}.completion`,
2644
2643
  url: ({ path }) => `${baseURL}${path}`,
2645
2644
  headers: getHeaders,
2646
- compatibility,
2647
2645
  fetch: options.fetch
2648
2646
  });
2649
2647
  const createEmbeddingModel = (modelId) => new OpenAIEmbeddingModel(modelId, {
@@ -2652,7 +2650,7 @@ function createOpenAI(options = {}) {
2652
2650
  headers: getHeaders,
2653
2651
  fetch: options.fetch
2654
2652
  });
2655
- const createImageModel = (modelId, settings = {}) => new OpenAIImageModel(modelId, settings, {
2653
+ const createImageModel = (modelId) => new OpenAIImageModel(modelId, {
2656
2654
  provider: `${providerName}.image`,
2657
2655
  url: ({ path }) => `${baseURL}${path}`,
2658
2656
  headers: getHeaders,
@@ -2708,10 +2706,7 @@ function createOpenAI(options = {}) {
2708
2706
  provider.tools = openaiTools;
2709
2707
  return provider;
2710
2708
  }
2711
- var openai = createOpenAI({
2712
- compatibility: "strict"
2713
- // strict for OpenAI API
2714
- });
2709
+ var openai = createOpenAI();
2715
2710
  export {
2716
2711
  createOpenAI,
2717
2712
  openai