@ai-sdk/openai 4.0.43 → 4.0.44

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,13 @@
1
1
  # @ai-sdk/openai
2
2
 
3
+ ## 4.0.44
4
+
5
+ ### Patch Changes
6
+
7
+ - e6087c9: fix: handle empty string tool call IDs
8
+ - Updated dependencies [e6087c9]
9
+ - @ai-sdk/provider-utils@5.0.28
10
+
3
11
  ## 4.0.43
4
12
 
5
13
  ### Patch Changes
package/dist/index.js CHANGED
@@ -1152,7 +1152,7 @@ var OpenAIChatLanguageModel = class _OpenAIChatLanguageModel {
1152
1152
  };
1153
1153
  }
1154
1154
  async doGenerate(options) {
1155
- var _a, _b, _c, _d, _e, _f, _g, _h;
1155
+ var _a, _b, _c, _d, _e, _f, _g;
1156
1156
  const { args: body, warnings } = await this.getArgs(options);
1157
1157
  const {
1158
1158
  responseHeaders,
@@ -1181,12 +1181,12 @@ var OpenAIChatLanguageModel = class _OpenAIChatLanguageModel {
1181
1181
  for (const toolCall of (_c = choice.message.tool_calls) != null ? _c : []) {
1182
1182
  content.push({
1183
1183
  type: "tool-call",
1184
- toolCallId: (_d = toolCall.id) != null ? _d : generateId(),
1184
+ toolCallId: toolCall.id || generateId(),
1185
1185
  toolName: toolCall.function.name,
1186
1186
  input: toolCall.function.arguments
1187
1187
  });
1188
1188
  }
1189
- for (const annotation of (_e = choice.message.annotations) != null ? _e : []) {
1189
+ for (const annotation of (_d = choice.message.annotations) != null ? _d : []) {
1190
1190
  content.push({
1191
1191
  type: "source",
1192
1192
  sourceType: "url",
@@ -1195,7 +1195,7 @@ var OpenAIChatLanguageModel = class _OpenAIChatLanguageModel {
1195
1195
  title: annotation.url_citation.title
1196
1196
  });
1197
1197
  }
1198
- const completionTokenDetails = (_f = response.usage) == null ? void 0 : _f.completion_tokens_details;
1198
+ const completionTokenDetails = (_e = response.usage) == null ? void 0 : _e.completion_tokens_details;
1199
1199
  const providerMetadata = { openai: {} };
1200
1200
  if ((completionTokenDetails == null ? void 0 : completionTokenDetails.accepted_prediction_tokens) != null) {
1201
1201
  providerMetadata.openai.acceptedPredictionTokens = completionTokenDetails == null ? void 0 : completionTokenDetails.accepted_prediction_tokens;
@@ -1203,14 +1203,14 @@ var OpenAIChatLanguageModel = class _OpenAIChatLanguageModel {
1203
1203
  if ((completionTokenDetails == null ? void 0 : completionTokenDetails.rejected_prediction_tokens) != null) {
1204
1204
  providerMetadata.openai.rejectedPredictionTokens = completionTokenDetails == null ? void 0 : completionTokenDetails.rejected_prediction_tokens;
1205
1205
  }
1206
- if (((_g = choice.logprobs) == null ? void 0 : _g.content) != null) {
1206
+ if (((_f = choice.logprobs) == null ? void 0 : _f.content) != null) {
1207
1207
  providerMetadata.openai.logprobs = choice.logprobs.content;
1208
1208
  }
1209
1209
  return {
1210
1210
  content,
1211
1211
  finishReason: {
1212
1212
  unified: mapOpenAIFinishReason(choice.finish_reason),
1213
- raw: (_h = choice.finish_reason) != null ? _h : void 0
1213
+ raw: (_g = choice.finish_reason) != null ? _g : void 0
1214
1214
  },
1215
1215
  usage: convertOpenAIChatUsage(response.usage),
1216
1216
  request: { body },
@@ -10160,7 +10160,7 @@ var OpenAISkills = class {
10160
10160
  };
10161
10161
 
10162
10162
  // src/version.ts
10163
- var VERSION = true ? "4.0.43" : "0.0.0-test";
10163
+ var VERSION = true ? "4.0.44" : "0.0.0-test";
10164
10164
 
10165
10165
  // src/openai-provider.ts
10166
10166
  function createOpenAI(options = {}) {