@ai-sdk/openai 4.0.0-canary.61 → 4.0.0-canary.63

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,17 @@
1
1
  # @ai-sdk/openai
2
2
 
3
+ ## 4.0.0-canary.63
4
+
5
+ ### Patch Changes
6
+
7
+ - 17b5597: fix(openai): skip passing reasoning items when using previous response id
8
+
9
+ ## 4.0.0-canary.62
10
+
11
+ ### Patch Changes
12
+
13
+ - bf837fe: feat(provider/gateway): add speech and transcription model support
14
+
3
15
  ## 4.0.0-canary.61
4
16
 
5
17
  ### Patch Changes
package/dist/index.js CHANGED
@@ -2956,6 +2956,7 @@ async function convertToOpenAIResponsesInput({
2956
2956
  passThroughUnsupportedFiles = false,
2957
2957
  store,
2958
2958
  hasConversation = false,
2959
+ hasPreviousResponseId = false,
2959
2960
  hasLocalShellTool = false,
2960
2961
  hasShellTool = false,
2961
2962
  hasApplyPatchTool = false,
@@ -3127,6 +3128,9 @@ async function convertToOpenAIResponsesInput({
3127
3128
  break;
3128
3129
  }
3129
3130
  if (store && id != null) {
3131
+ if (hasPreviousResponseId) {
3132
+ break;
3133
+ }
3130
3134
  input.push({ type: "item_reference", id });
3131
3135
  break;
3132
3136
  }
@@ -3271,7 +3275,7 @@ async function convertToOpenAIResponsesInput({
3271
3275
  schema: openaiResponsesReasoningProviderOptionsSchema
3272
3276
  });
3273
3277
  const reasoningId = providerOptions == null ? void 0 : providerOptions.itemId;
3274
- if (hasConversation && reasoningId != null) {
3278
+ if ((hasConversation || hasPreviousResponseId) && reasoningId != null) {
3275
3279
  break;
3276
3280
  }
3277
3281
  if (reasoningId != null) {
@@ -5205,6 +5209,7 @@ var OpenAIResponsesLanguageModel = class _OpenAIResponsesLanguageModel {
5205
5209
  passThroughUnsupportedFiles: (_e = openaiOptions == null ? void 0 : openaiOptions.passThroughUnsupportedFiles) != null ? _e : false,
5206
5210
  store: (_f = openaiOptions == null ? void 0 : openaiOptions.store) != null ? _f : true,
5207
5211
  hasConversation: (openaiOptions == null ? void 0 : openaiOptions.conversation) != null,
5212
+ hasPreviousResponseId: (openaiOptions == null ? void 0 : openaiOptions.previousResponseId) != null,
5208
5213
  hasLocalShellTool: hasOpenAITool("openai.local_shell"),
5209
5214
  hasShellTool: hasOpenAITool("openai.shell"),
5210
5215
  hasApplyPatchTool: hasOpenAITool("openai.apply_patch"),
@@ -7139,17 +7144,23 @@ var OpenAITranscriptionModel = class _OpenAITranscriptionModel {
7139
7144
  new File([blob], "audio", { type: mediaType }),
7140
7145
  `audio.${fileExtension}`
7141
7146
  );
7147
+ if (this.modelId === "whisper-1") {
7148
+ formData.append("response_format", "verbose_json");
7149
+ }
7142
7150
  if (openAIOptions) {
7151
+ const isGpt4oTranscribeModel = [
7152
+ "gpt-4o-transcribe",
7153
+ "gpt-4o-mini-transcribe"
7154
+ ].includes(this.modelId);
7143
7155
  const transcriptionModelOptions = {
7144
7156
  include: openAIOptions.include,
7145
7157
  language: openAIOptions.language,
7146
7158
  prompt: openAIOptions.prompt,
7147
7159
  // https://platform.openai.com/docs/api-reference/audio/createTranscription#audio_createtranscription-response_format
7148
7160
  // prefer verbose_json to get segments for models that support it
7149
- response_format: [
7150
- "gpt-4o-transcribe",
7151
- "gpt-4o-mini-transcribe"
7152
- ].includes(this.modelId) ? "json" : "verbose_json",
7161
+ ...this.modelId !== "whisper-1" && {
7162
+ response_format: isGpt4oTranscribeModel ? "json" : "verbose_json"
7163
+ },
7153
7164
  temperature: openAIOptions.temperature,
7154
7165
  timestamp_granularities: openAIOptions.timestampGranularities
7155
7166
  };
@@ -7302,7 +7313,7 @@ var OpenAISkills = class {
7302
7313
  };
7303
7314
 
7304
7315
  // src/version.ts
7305
- var VERSION = true ? "4.0.0-canary.61" : "0.0.0-test";
7316
+ var VERSION = true ? "4.0.0-canary.63" : "0.0.0-test";
7306
7317
 
7307
7318
  // src/openai-provider.ts
7308
7319
  function createOpenAI(options = {}) {