ai 6.0.323 → 6.0.325

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.
@@ -903,9 +903,9 @@ export async function generateText<
903
903
  'ai.response.model': responseData.modelId,
904
904
  'ai.response.timestamp':
905
905
  responseData.timestamp.toISOString(),
906
- 'ai.response.providerMetadata': JSON.stringify(
907
- result.providerMetadata,
908
- ),
906
+ 'ai.response.providerMetadata': {
907
+ output: () => JSON.stringify(result.providerMetadata),
908
+ },
909
909
 
910
910
  'ai.usage.inputTokens': result.usage.inputTokens.total,
911
911
  'ai.usage.inputTokenDetails.noCacheTokens':
@@ -1251,9 +1251,10 @@ export async function generateText<
1251
1251
  : JSON.stringify(toolCalls);
1252
1252
  },
1253
1253
  },
1254
- 'ai.response.providerMetadata': JSON.stringify(
1255
- currentModelResponse.providerMetadata,
1256
- ),
1254
+ 'ai.response.providerMetadata': {
1255
+ output: () =>
1256
+ JSON.stringify(currentModelResponse.providerMetadata),
1257
+ },
1257
1258
  },
1258
1259
  }),
1259
1260
  );
@@ -1323,9 +1323,9 @@ class DefaultStreamTextResult<
1323
1323
  ? JSON.stringify(finalStep.toolCalls)
1324
1324
  : undefined,
1325
1325
  },
1326
- 'ai.response.providerMetadata': JSON.stringify(
1327
- finalStep.providerMetadata,
1328
- ),
1326
+ 'ai.response.providerMetadata': {
1327
+ output: () => JSON.stringify(finalStep.providerMetadata),
1328
+ },
1329
1329
  'ai.usage.inputTokens': totalUsage.inputTokens,
1330
1330
  'ai.usage.inputTokenDetails.noCacheTokens':
1331
1331
  totalUsage.inputTokenDetails?.noCacheTokens,
@@ -2333,9 +2333,10 @@ class DefaultStreamTextResult<
2333
2333
  'ai.response.reasoning': {
2334
2334
  output: () => processedStep.reasoningText,
2335
2335
  },
2336
- 'ai.response.providerMetadata': JSON.stringify(
2337
- processedStep.providerMetadata,
2338
- ),
2336
+ 'ai.response.providerMetadata': {
2337
+ output: () =>
2338
+ JSON.stringify(processedStep.providerMetadata),
2339
+ },
2339
2340
  },
2340
2341
  }),
2341
2342
  );
@@ -25,7 +25,8 @@ export async function prepareToolsAndToolChoice<TOOLS extends ToolSet>({
25
25
  if (!isNonEmptyObject(tools)) {
26
26
  return {
27
27
  tools: undefined,
28
- toolChoice: undefined,
28
+ // Providers can configure native tools without SDK tools.
29
+ toolChoice: toolChoice === 'none' ? { type: 'none' } : undefined,
29
30
  };
30
31
  }
31
32