@ai-sdk/openai 3.0.34 → 3.0.36

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,35 @@
1
1
  # @ai-sdk/openai
2
2
 
3
+ ## 3.0.36
4
+
5
+ ### Patch Changes
6
+
7
+ - 53bdfa5: fix(openai): allow null/undefined type in streaming tool call deltas
8
+
9
+ Azure AI Foundry and Mistral deployed on Azure omit the `type` field in
10
+ streaming tool_calls deltas. The chat stream parser now accepts a missing
11
+ `type` field (treating it as `"function"`) instead of throwing
12
+ `InvalidResponseDataError: Expected 'function' type.`
13
+
14
+ Fixes #12770
15
+
16
+ ## 3.0.35
17
+
18
+ ### Patch Changes
19
+
20
+ - 5e18272: fix(openai): include reasoning parts without itemId when encrypted_content is present
21
+
22
+ When `providerOptions.openai.itemId` is absent on a reasoning content part,
23
+ the converter now uses `encrypted_content` as a fallback instead of silently
24
+ skipping the part with a warning. The OpenAI Responses API accepts reasoning
25
+ items without an `id` when `encrypted_content` is supplied, enabling
26
+ multi-turn reasoning even when item IDs are stripped from provider options.
27
+
28
+ Also makes the `id` field optional on the `OpenAIResponsesReasoning` type to
29
+ reflect that the API does not require it.
30
+
31
+ Fixes #12853
32
+
3
33
  ## 3.0.34
4
34
 
5
35
  ### Patch Changes
package/dist/index.js CHANGED
@@ -1014,7 +1014,7 @@ var OpenAIChatLanguageModel = class {
1014
1014
  for (const toolCallDelta of delta.tool_calls) {
1015
1015
  const index = toolCallDelta.index;
1016
1016
  if (toolCalls[index] == null) {
1017
- if (toolCallDelta.type !== "function") {
1017
+ if (toolCallDelta.type != null && toolCallDelta.type !== "function") {
1018
1018
  throw new import_provider3.InvalidResponseDataError({
1019
1019
  data: toolCallDelta,
1020
1020
  message: `Expected 'function' type.`
@@ -2846,10 +2846,26 @@ async function convertToOpenAIResponsesInput({
2846
2846
  }
2847
2847
  }
2848
2848
  } else {
2849
- warnings.push({
2850
- type: "other",
2851
- message: `Non-OpenAI reasoning parts are not supported. Skipping reasoning part: ${JSON.stringify(part)}.`
2852
- });
2849
+ const encryptedContent = providerOptions == null ? void 0 : providerOptions.reasoningEncryptedContent;
2850
+ if (encryptedContent != null) {
2851
+ const summaryParts = [];
2852
+ if (part.text.length > 0) {
2853
+ summaryParts.push({
2854
+ type: "summary_text",
2855
+ text: part.text
2856
+ });
2857
+ }
2858
+ input.push({
2859
+ type: "reasoning",
2860
+ encrypted_content: encryptedContent,
2861
+ summary: summaryParts
2862
+ });
2863
+ } else {
2864
+ warnings.push({
2865
+ type: "other",
2866
+ message: `Non-OpenAI reasoning parts are not supported. Skipping reasoning part: ${JSON.stringify(part)}.`
2867
+ });
2868
+ }
2853
2869
  }
2854
2870
  break;
2855
2871
  }
@@ -6081,7 +6097,7 @@ var OpenAITranscriptionModel = class {
6081
6097
  };
6082
6098
 
6083
6099
  // src/version.ts
6084
- var VERSION = true ? "3.0.34" : "0.0.0-test";
6100
+ var VERSION = true ? "3.0.36" : "0.0.0-test";
6085
6101
 
6086
6102
  // src/openai-provider.ts
6087
6103
  function createOpenAI(options = {}) {