@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.
@@ -1143,7 +1143,7 @@ var OpenAIChatLanguageModel = class _OpenAIChatLanguageModel {
1143
1143
  };
1144
1144
  }
1145
1145
  async doGenerate(options) {
1146
- var _a, _b, _c, _d, _e, _f, _g, _h;
1146
+ var _a, _b, _c, _d, _e, _f, _g;
1147
1147
  const { args: body, warnings } = await this.getArgs(options);
1148
1148
  const {
1149
1149
  responseHeaders,
@@ -1172,12 +1172,12 @@ var OpenAIChatLanguageModel = class _OpenAIChatLanguageModel {
1172
1172
  for (const toolCall of (_c = choice.message.tool_calls) != null ? _c : []) {
1173
1173
  content.push({
1174
1174
  type: "tool-call",
1175
- toolCallId: (_d = toolCall.id) != null ? _d : generateId(),
1175
+ toolCallId: toolCall.id || generateId(),
1176
1176
  toolName: toolCall.function.name,
1177
1177
  input: toolCall.function.arguments
1178
1178
  });
1179
1179
  }
1180
- for (const annotation of (_e = choice.message.annotations) != null ? _e : []) {
1180
+ for (const annotation of (_d = choice.message.annotations) != null ? _d : []) {
1181
1181
  content.push({
1182
1182
  type: "source",
1183
1183
  sourceType: "url",
@@ -1186,7 +1186,7 @@ var OpenAIChatLanguageModel = class _OpenAIChatLanguageModel {
1186
1186
  title: annotation.url_citation.title
1187
1187
  });
1188
1188
  }
1189
- const completionTokenDetails = (_f = response.usage) == null ? void 0 : _f.completion_tokens_details;
1189
+ const completionTokenDetails = (_e = response.usage) == null ? void 0 : _e.completion_tokens_details;
1190
1190
  const providerMetadata = { openai: {} };
1191
1191
  if ((completionTokenDetails == null ? void 0 : completionTokenDetails.accepted_prediction_tokens) != null) {
1192
1192
  providerMetadata.openai.acceptedPredictionTokens = completionTokenDetails == null ? void 0 : completionTokenDetails.accepted_prediction_tokens;
@@ -1194,14 +1194,14 @@ var OpenAIChatLanguageModel = class _OpenAIChatLanguageModel {
1194
1194
  if ((completionTokenDetails == null ? void 0 : completionTokenDetails.rejected_prediction_tokens) != null) {
1195
1195
  providerMetadata.openai.rejectedPredictionTokens = completionTokenDetails == null ? void 0 : completionTokenDetails.rejected_prediction_tokens;
1196
1196
  }
1197
- if (((_g = choice.logprobs) == null ? void 0 : _g.content) != null) {
1197
+ if (((_f = choice.logprobs) == null ? void 0 : _f.content) != null) {
1198
1198
  providerMetadata.openai.logprobs = choice.logprobs.content;
1199
1199
  }
1200
1200
  return {
1201
1201
  content,
1202
1202
  finishReason: {
1203
1203
  unified: mapOpenAIFinishReason(choice.finish_reason),
1204
- raw: (_h = choice.finish_reason) != null ? _h : void 0
1204
+ raw: (_g = choice.finish_reason) != null ? _g : void 0
1205
1205
  },
1206
1206
  usage: convertOpenAIChatUsage(response.usage),
1207
1207
  request: { body },