@ai-sdk/openai 2.0.94 → 2.0.95

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,18 @@
1
1
  # @ai-sdk/openai
2
2
 
3
+ ## 2.0.95
4
+
5
+ ### Patch Changes
6
+
7
+ - b08351e: 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
+
3
16
  ## 2.0.94
4
17
 
5
18
  ### Patch Changes
package/dist/index.js CHANGED
@@ -971,7 +971,7 @@ var OpenAIChatLanguageModel = class {
971
971
  for (const toolCallDelta of delta.tool_calls) {
972
972
  const index = toolCallDelta.index;
973
973
  if (toolCalls[index] == null) {
974
- if (toolCallDelta.type !== "function") {
974
+ if (toolCallDelta.type != null && toolCallDelta.type !== "function") {
975
975
  throw new import_provider3.InvalidResponseDataError({
976
976
  data: toolCallDelta,
977
977
  message: `Expected 'function' type.`
@@ -4606,7 +4606,7 @@ var OpenAITranscriptionModel = class {
4606
4606
  };
4607
4607
 
4608
4608
  // src/version.ts
4609
- var VERSION = true ? "2.0.94" : "0.0.0-test";
4609
+ var VERSION = true ? "2.0.95" : "0.0.0-test";
4610
4610
 
4611
4611
  // src/openai-provider.ts
4612
4612
  function createOpenAI(options = {}) {