@ai-sdk/openai 2.0.19 → 2.0.20

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,11 @@
1
1
  # @ai-sdk/openai
2
2
 
3
+ ## 2.0.20
4
+
5
+ ### Patch Changes
6
+
7
+ - 974de40: fix(provider/ai): do not set `.providerMetadata.openai.logprobs` to an array of empty arrays when using `streamText()`
8
+
3
9
  ## 2.0.19
4
10
 
5
11
  ### Patch Changes
package/dist/index.js CHANGED
@@ -2679,7 +2679,7 @@ var OpenAIResponsesLanguageModel = class {
2679
2679
  controller.enqueue({ type: "stream-start", warnings });
2680
2680
  },
2681
2681
  transform(chunk, controller) {
2682
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p;
2682
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r;
2683
2683
  if (options.includeRawChunks) {
2684
2684
  controller.enqueue({ type: "raw", rawValue: chunk.rawValue });
2685
2685
  }
@@ -2890,12 +2890,12 @@ var OpenAIResponsesLanguageModel = class {
2890
2890
  id: value.item_id,
2891
2891
  delta: value.delta
2892
2892
  });
2893
- if (value.logprobs) {
2893
+ if (((_d = (_c = options.providerOptions) == null ? void 0 : _c.openai) == null ? void 0 : _d.logprobs) && value.logprobs) {
2894
2894
  logprobs.push(value.logprobs);
2895
2895
  }
2896
2896
  } else if (isResponseReasoningSummaryPartAddedChunk(value)) {
2897
2897
  if (value.summary_index > 0) {
2898
- (_c = activeReasoning[value.item_id]) == null ? void 0 : _c.summaryParts.push(
2898
+ (_e = activeReasoning[value.item_id]) == null ? void 0 : _e.summaryParts.push(
2899
2899
  value.summary_index
2900
2900
  );
2901
2901
  controller.enqueue({
@@ -2904,7 +2904,7 @@ var OpenAIResponsesLanguageModel = class {
2904
2904
  providerMetadata: {
2905
2905
  openai: {
2906
2906
  itemId: value.item_id,
2907
- reasoningEncryptedContent: (_e = (_d = activeReasoning[value.item_id]) == null ? void 0 : _d.encryptedContent) != null ? _e : null
2907
+ reasoningEncryptedContent: (_g = (_f = activeReasoning[value.item_id]) == null ? void 0 : _f.encryptedContent) != null ? _g : null
2908
2908
  }
2909
2909
  }
2910
2910
  });
@@ -2922,20 +2922,20 @@ var OpenAIResponsesLanguageModel = class {
2922
2922
  });
2923
2923
  } else if (isResponseFinishedChunk(value)) {
2924
2924
  finishReason = mapOpenAIResponseFinishReason({
2925
- finishReason: (_f = value.response.incomplete_details) == null ? void 0 : _f.reason,
2925
+ finishReason: (_h = value.response.incomplete_details) == null ? void 0 : _h.reason,
2926
2926
  hasToolCalls
2927
2927
  });
2928
2928
  usage.inputTokens = value.response.usage.input_tokens;
2929
2929
  usage.outputTokens = value.response.usage.output_tokens;
2930
2930
  usage.totalTokens = value.response.usage.input_tokens + value.response.usage.output_tokens;
2931
- usage.reasoningTokens = (_h = (_g = value.response.usage.output_tokens_details) == null ? void 0 : _g.reasoning_tokens) != null ? _h : void 0;
2932
- usage.cachedInputTokens = (_j = (_i = value.response.usage.input_tokens_details) == null ? void 0 : _i.cached_tokens) != null ? _j : void 0;
2931
+ usage.reasoningTokens = (_j = (_i = value.response.usage.output_tokens_details) == null ? void 0 : _i.reasoning_tokens) != null ? _j : void 0;
2932
+ usage.cachedInputTokens = (_l = (_k = value.response.usage.input_tokens_details) == null ? void 0 : _k.cached_tokens) != null ? _l : void 0;
2933
2933
  } else if (isResponseAnnotationAddedChunk(value)) {
2934
2934
  if (value.annotation.type === "url_citation") {
2935
2935
  controller.enqueue({
2936
2936
  type: "source",
2937
2937
  sourceType: "url",
2938
- id: (_m = (_l = (_k = self.config).generateId) == null ? void 0 : _l.call(_k)) != null ? _m : (0, import_provider_utils12.generateId)(),
2938
+ id: (_o = (_n = (_m = self.config).generateId) == null ? void 0 : _n.call(_m)) != null ? _o : (0, import_provider_utils12.generateId)(),
2939
2939
  url: value.annotation.url,
2940
2940
  title: value.annotation.title
2941
2941
  });
@@ -2943,7 +2943,7 @@ var OpenAIResponsesLanguageModel = class {
2943
2943
  controller.enqueue({
2944
2944
  type: "source",
2945
2945
  sourceType: "document",
2946
- id: (_p = (_o = (_n = self.config).generateId) == null ? void 0 : _o.call(_n)) != null ? _p : (0, import_provider_utils12.generateId)(),
2946
+ id: (_r = (_q = (_p = self.config).generateId) == null ? void 0 : _q.call(_p)) != null ? _r : (0, import_provider_utils12.generateId)(),
2947
2947
  mediaType: "text/plain",
2948
2948
  title: value.annotation.quote,
2949
2949
  filename: value.annotation.file_id