@ai-sdk/openai 1.3.9 → 1.3.10

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 CHANGED
@@ -1,5 +1,12 @@
1
1
  # @ai-sdk/openai
2
2
 
3
+ ## 1.3.10
4
+
5
+ ### Patch Changes
6
+
7
+ - dbe53e7: adding support for gpt-4o-search-preview and handling unsupported parameters
8
+ - 84ffaba: fix: propagate openai transcription fixes
9
+
3
10
  ## 1.3.9
4
11
 
5
12
  ### Patch Changes
package/dist/index.d.mts CHANGED
@@ -2,7 +2,7 @@ import { LanguageModelV1, ProviderV1, EmbeddingModelV1, ImageModelV1, Transcript
2
2
  import { FetchFunction } from '@ai-sdk/provider-utils';
3
3
  import { z } from 'zod';
4
4
 
5
- type OpenAIChatModelId = 'o1' | 'o1-2024-12-17' | 'o1-mini' | 'o1-mini-2024-09-12' | 'o1-preview' | 'o1-preview-2024-09-12' | 'o3-mini' | 'o3-mini-2025-01-31' | 'gpt-4o' | 'gpt-4o-2024-05-13' | 'gpt-4o-2024-08-06' | 'gpt-4o-2024-11-20' | 'gpt-4o-audio-preview' | 'gpt-4o-audio-preview-2024-10-01' | 'gpt-4o-audio-preview-2024-12-17' | 'gpt-4o-mini' | 'gpt-4o-mini-2024-07-18' | 'gpt-4-turbo' | 'gpt-4-turbo-2024-04-09' | 'gpt-4-turbo-preview' | 'gpt-4-0125-preview' | 'gpt-4-1106-preview' | 'gpt-4' | 'gpt-4-0613' | 'gpt-4.5-preview' | 'gpt-4.5-preview-2025-02-27' | 'gpt-3.5-turbo-0125' | 'gpt-3.5-turbo' | 'gpt-3.5-turbo-1106' | 'chatgpt-4o-latest' | (string & {});
5
+ type OpenAIChatModelId = 'o1' | 'o1-2024-12-17' | 'o1-mini' | 'o1-mini-2024-09-12' | 'o1-preview' | 'o1-preview-2024-09-12' | 'o3-mini' | 'o3-mini-2025-01-31' | 'gpt-4o' | 'gpt-4o-2024-05-13' | 'gpt-4o-2024-08-06' | 'gpt-4o-2024-11-20' | 'gpt-4o-audio-preview' | 'gpt-4o-audio-preview-2024-10-01' | 'gpt-4o-audio-preview-2024-12-17' | 'gpt-4o-search-preview' | 'gpt-4o-search-preview-2025-03-11' | 'gpt-4o-mini' | 'gpt-4o-mini-2024-07-18' | 'gpt-4-turbo' | 'gpt-4-turbo-2024-04-09' | 'gpt-4-turbo-preview' | 'gpt-4-0125-preview' | 'gpt-4-1106-preview' | 'gpt-4' | 'gpt-4-0613' | 'gpt-4.5-preview' | 'gpt-4.5-preview-2025-02-27' | 'gpt-3.5-turbo-0125' | 'gpt-3.5-turbo' | 'gpt-3.5-turbo-1106' | 'chatgpt-4o-latest' | (string & {});
6
6
  interface OpenAIChatSettings {
7
7
  /**
8
8
  Modify the likelihood of specified tokens appearing in the completion.
package/dist/index.d.ts CHANGED
@@ -2,7 +2,7 @@ import { LanguageModelV1, ProviderV1, EmbeddingModelV1, ImageModelV1, Transcript
2
2
  import { FetchFunction } from '@ai-sdk/provider-utils';
3
3
  import { z } from 'zod';
4
4
 
5
- type OpenAIChatModelId = 'o1' | 'o1-2024-12-17' | 'o1-mini' | 'o1-mini-2024-09-12' | 'o1-preview' | 'o1-preview-2024-09-12' | 'o3-mini' | 'o3-mini-2025-01-31' | 'gpt-4o' | 'gpt-4o-2024-05-13' | 'gpt-4o-2024-08-06' | 'gpt-4o-2024-11-20' | 'gpt-4o-audio-preview' | 'gpt-4o-audio-preview-2024-10-01' | 'gpt-4o-audio-preview-2024-12-17' | 'gpt-4o-mini' | 'gpt-4o-mini-2024-07-18' | 'gpt-4-turbo' | 'gpt-4-turbo-2024-04-09' | 'gpt-4-turbo-preview' | 'gpt-4-0125-preview' | 'gpt-4-1106-preview' | 'gpt-4' | 'gpt-4-0613' | 'gpt-4.5-preview' | 'gpt-4.5-preview-2025-02-27' | 'gpt-3.5-turbo-0125' | 'gpt-3.5-turbo' | 'gpt-3.5-turbo-1106' | 'chatgpt-4o-latest' | (string & {});
5
+ type OpenAIChatModelId = 'o1' | 'o1-2024-12-17' | 'o1-mini' | 'o1-mini-2024-09-12' | 'o1-preview' | 'o1-preview-2024-09-12' | 'o3-mini' | 'o3-mini-2025-01-31' | 'gpt-4o' | 'gpt-4o-2024-05-13' | 'gpt-4o-2024-08-06' | 'gpt-4o-2024-11-20' | 'gpt-4o-audio-preview' | 'gpt-4o-audio-preview-2024-10-01' | 'gpt-4o-audio-preview-2024-12-17' | 'gpt-4o-search-preview' | 'gpt-4o-search-preview-2025-03-11' | 'gpt-4o-mini' | 'gpt-4o-mini-2024-07-18' | 'gpt-4-turbo' | 'gpt-4-turbo-2024-04-09' | 'gpt-4-turbo-preview' | 'gpt-4-0125-preview' | 'gpt-4-1106-preview' | 'gpt-4' | 'gpt-4-0613' | 'gpt-4.5-preview' | 'gpt-4.5-preview-2025-02-27' | 'gpt-3.5-turbo-0125' | 'gpt-3.5-turbo' | 'gpt-3.5-turbo-1106' | 'chatgpt-4o-latest' | (string & {});
6
6
  interface OpenAIChatSettings {
7
7
  /**
8
8
  Modify the likelihood of specified tokens appearing in the completion.
package/dist/index.js CHANGED
@@ -536,6 +536,15 @@ var OpenAIChatLanguageModel = class {
536
536
  }
537
537
  baseArgs.max_tokens = void 0;
538
538
  }
539
+ } else if (this.modelId.startsWith("gpt-4o-search-preview")) {
540
+ if (baseArgs.temperature != null) {
541
+ baseArgs.temperature = void 0;
542
+ warnings.push({
543
+ type: "unsupported-setting",
544
+ setting: "temperature",
545
+ details: "temperature is not supported for the gpt-4o-search-preview model and has been removed."
546
+ });
547
+ }
539
548
  }
540
549
  switch (type) {
541
550
  case "regular": {
@@ -1605,17 +1614,11 @@ var openaiImageResponseSchema = import_zod5.z.object({
1605
1614
  var import_provider_utils7 = require("@ai-sdk/provider-utils");
1606
1615
  var import_zod6 = require("zod");
1607
1616
  var OpenAIProviderOptionsSchema = import_zod6.z.object({
1608
- include: import_zod6.z.array(import_zod6.z.string()).optional().describe(
1609
- "Additional information to include in the transcription response."
1610
- ),
1611
- language: import_zod6.z.string().optional().describe("The language of the input audio in ISO-639-1 format."),
1612
- prompt: import_zod6.z.string().optional().describe(
1613
- "An optional text to guide the model's style or continue a previous audio segment."
1614
- ),
1615
- temperature: import_zod6.z.number().min(0).max(1).optional().default(0).describe("The sampling temperature, between 0 and 1."),
1616
- timestampGranularities: import_zod6.z.array(import_zod6.z.enum(["word", "segment"])).optional().default(["segment"]).describe(
1617
- "The timestamp granularities to populate for this transcription."
1618
- )
1617
+ include: import_zod6.z.array(import_zod6.z.string()).nullish(),
1618
+ language: import_zod6.z.string().nullish(),
1619
+ prompt: import_zod6.z.string().nullish(),
1620
+ temperature: import_zod6.z.number().min(0).max(1).nullish().default(0),
1621
+ timestampGranularities: import_zod6.z.array(import_zod6.z.enum(["word", "segment"])).nullish().default(["segment"])
1619
1622
  });
1620
1623
  var languageMap = {
1621
1624
  afrikaans: "af",
@@ -1690,6 +1693,7 @@ var OpenAITranscriptionModel = class {
1690
1693
  mediaType,
1691
1694
  providerOptions
1692
1695
  }) {
1696
+ var _a, _b, _c, _d, _e;
1693
1697
  const warnings = [];
1694
1698
  const openAIOptions = (0, import_provider_utils7.parseProviderOptions)({
1695
1699
  provider: "openai",
@@ -1702,16 +1706,16 @@ var OpenAITranscriptionModel = class {
1702
1706
  formData.append("file", new File([blob], "audio", { type: mediaType }));
1703
1707
  if (openAIOptions) {
1704
1708
  const transcriptionModelOptions = {
1705
- include: openAIOptions.include,
1706
- language: openAIOptions.language,
1707
- prompt: openAIOptions.prompt,
1708
- temperature: openAIOptions.temperature,
1709
- timestamp_granularities: openAIOptions.timestampGranularities
1709
+ include: (_a = openAIOptions.include) != null ? _a : void 0,
1710
+ language: (_b = openAIOptions.language) != null ? _b : void 0,
1711
+ prompt: (_c = openAIOptions.prompt) != null ? _c : void 0,
1712
+ temperature: (_d = openAIOptions.temperature) != null ? _d : void 0,
1713
+ timestamp_granularities: (_e = openAIOptions.timestampGranularities) != null ? _e : void 0
1710
1714
  };
1711
1715
  for (const key in transcriptionModelOptions) {
1712
1716
  const value = transcriptionModelOptions[key];
1713
1717
  if (value !== void 0) {
1714
- formData.append(key, value);
1718
+ formData.append(key, String(value));
1715
1719
  }
1716
1720
  }
1717
1721
  }