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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,26 @@
1
1
  # ai
2
2
 
3
+ ## 6.0.325
4
+
5
+ ### Patch Changes
6
+
7
+ - 4ac871e: hide provider metadata from telemetry when recordOutputs is false
8
+ - Updated dependencies [f0dee4b]
9
+ - @ai-sdk/provider-utils@4.0.65
10
+ - @ai-sdk/gateway@3.0.231
11
+
12
+ ## 6.0.324
13
+
14
+ ### Patch Changes
15
+
16
+ - ba3743f: Preserve `toolChoice: 'none'` when SDK tools are omitted or empty so providers can disable native tools configured through provider options.
17
+
18
+ For Perplexity native tools, also update `@ai-sdk/perplexity` to `3.1.10` or a later compatible version, which includes the provider-side guard.
19
+
20
+ - Updated dependencies [fbb8489]
21
+ - Updated dependencies [26b7351]
22
+ - @ai-sdk/gateway@3.0.230
23
+
3
24
  ## 6.0.323
4
25
 
5
26
  ### Patch Changes
package/dist/index.js CHANGED
@@ -1335,7 +1335,7 @@ function detectMediaType({
1335
1335
  var import_provider_utils3 = require("@ai-sdk/provider-utils");
1336
1336
 
1337
1337
  // src/version.ts
1338
- var VERSION = true ? "6.0.323" : "0.0.0-test";
1338
+ var VERSION = true ? "6.0.325" : "0.0.0-test";
1339
1339
 
1340
1340
  // src/util/download/download.ts
1341
1341
  var download = async ({
@@ -2059,7 +2059,8 @@ async function prepareToolsAndToolChoice({
2059
2059
  if (!isNonEmptyObject(tools)) {
2060
2060
  return {
2061
2061
  tools: void 0,
2062
- toolChoice: void 0
2062
+ // Providers can configure native tools without SDK tools.
2063
+ toolChoice: toolChoice === "none" ? { type: "none" } : void 0
2063
2064
  };
2064
2065
  }
2065
2066
  const filteredTools = activeTools != null ? Object.entries(tools).filter(
@@ -5013,9 +5014,9 @@ async function generateText({
5013
5014
  "ai.response.id": responseData.id,
5014
5015
  "ai.response.model": responseData.modelId,
5015
5016
  "ai.response.timestamp": responseData.timestamp.toISOString(),
5016
- "ai.response.providerMetadata": JSON.stringify(
5017
- result.providerMetadata
5018
- ),
5017
+ "ai.response.providerMetadata": {
5018
+ output: () => JSON.stringify(result.providerMetadata)
5019
+ },
5019
5020
  "ai.usage.inputTokens": result.usage.inputTokens.total,
5020
5021
  "ai.usage.inputTokenDetails.noCacheTokens": result.usage.inputTokens.noCache,
5021
5022
  "ai.usage.inputTokenDetails.cacheReadTokens": result.usage.inputTokens.cacheRead,
@@ -5256,9 +5257,9 @@ async function generateText({
5256
5257
  return toolCalls == null ? void 0 : JSON.stringify(toolCalls);
5257
5258
  }
5258
5259
  },
5259
- "ai.response.providerMetadata": JSON.stringify(
5260
- currentModelResponse.providerMetadata
5261
- )
5260
+ "ai.response.providerMetadata": {
5261
+ output: () => JSON.stringify(currentModelResponse.providerMetadata)
5262
+ }
5262
5263
  }
5263
5264
  })
5264
5265
  );
@@ -7996,9 +7997,9 @@ var DefaultStreamTextResult = class {
7996
7997
  return ((_a24 = finalStep.toolCalls) == null ? void 0 : _a24.length) ? JSON.stringify(finalStep.toolCalls) : void 0;
7997
7998
  }
7998
7999
  },
7999
- "ai.response.providerMetadata": JSON.stringify(
8000
- finalStep.providerMetadata
8001
- ),
8000
+ "ai.response.providerMetadata": {
8001
+ output: () => JSON.stringify(finalStep.providerMetadata)
8002
+ },
8002
8003
  "ai.usage.inputTokens": totalUsage.inputTokens,
8003
8004
  "ai.usage.inputTokenDetails.noCacheTokens": (_a23 = totalUsage.inputTokenDetails) == null ? void 0 : _a23.noCacheTokens,
8004
8005
  "ai.usage.inputTokenDetails.cacheReadTokens": (_b = totalUsage.inputTokenDetails) == null ? void 0 : _b.cacheReadTokens,
@@ -8766,9 +8767,9 @@ var DefaultStreamTextResult = class {
8766
8767
  "ai.response.reasoning": {
8767
8768
  output: () => processedStep.reasoningText
8768
8769
  },
8769
- "ai.response.providerMetadata": JSON.stringify(
8770
- processedStep.providerMetadata
8771
- )
8770
+ "ai.response.providerMetadata": {
8771
+ output: () => JSON.stringify(processedStep.providerMetadata)
8772
+ }
8772
8773
  }
8773
8774
  })
8774
8775
  );
@@ -11889,9 +11890,9 @@ async function generateObject(options) {
11889
11890
  "ai.response.id": responseData.id,
11890
11891
  "ai.response.model": responseData.modelId,
11891
11892
  "ai.response.timestamp": responseData.timestamp.toISOString(),
11892
- "ai.response.providerMetadata": JSON.stringify(
11893
- result2.providerMetadata
11894
- ),
11893
+ "ai.response.providerMetadata": {
11894
+ output: () => JSON.stringify(result2.providerMetadata)
11895
+ },
11895
11896
  // TODO rename telemetry attributes to inputTokens and outputTokens
11896
11897
  "ai.usage.promptTokens": result2.usage.inputTokens.total,
11897
11898
  "ai.usage.completionTokens": result2.usage.outputTokens.total,
@@ -11946,9 +11947,9 @@ async function generateObject(options) {
11946
11947
  "ai.response.object": {
11947
11948
  output: () => JSON.stringify(object2)
11948
11949
  },
11949
- "ai.response.providerMetadata": JSON.stringify(
11950
- resultProviderMetadata
11951
- ),
11950
+ "ai.response.providerMetadata": {
11951
+ output: () => JSON.stringify(resultProviderMetadata)
11952
+ },
11952
11953
  // TODO rename telemetry attributes to inputTokens and outputTokens
11953
11954
  "ai.usage.promptTokens": usage.inputTokens,
11954
11955
  "ai.usage.completionTokens": usage.outputTokens
@@ -12512,7 +12513,9 @@ var DefaultStreamObjectResult = class {
12512
12513
  "ai.response.id": fullResponse.id,
12513
12514
  "ai.response.model": fullResponse.modelId,
12514
12515
  "ai.response.timestamp": fullResponse.timestamp.toISOString(),
12515
- "ai.response.providerMetadata": JSON.stringify(providerMetadata),
12516
+ "ai.response.providerMetadata": {
12517
+ output: () => JSON.stringify(providerMetadata)
12518
+ },
12516
12519
  "ai.usage.inputTokens": finalUsage.inputTokens,
12517
12520
  "ai.usage.outputTokens": finalUsage.outputTokens,
12518
12521
  "ai.usage.totalTokens": finalUsage.totalTokens,
@@ -12540,7 +12543,9 @@ var DefaultStreamObjectResult = class {
12540
12543
  "ai.response.object": {
12541
12544
  output: () => JSON.stringify(object2)
12542
12545
  },
12543
- "ai.response.providerMetadata": JSON.stringify(providerMetadata)
12546
+ "ai.response.providerMetadata": {
12547
+ output: () => JSON.stringify(providerMetadata)
12548
+ }
12544
12549
  }
12545
12550
  })
12546
12551
  );