@ai-sdk/google-vertex 5.0.0-beta.52 → 5.0.0-beta.54

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,23 @@
1
1
  # @ai-sdk/google-vertex
2
2
 
3
+ ## 5.0.0-beta.54
4
+
5
+ ### Major Changes
6
+
7
+ - 832f86f: fix(anthropic): remove cacheCreationInputTokens from providerMetadata
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies [832f86f]
12
+ - @ai-sdk/anthropic@4.0.0-beta.33
13
+
14
+ ## 5.0.0-beta.53
15
+
16
+ ### Patch Changes
17
+
18
+ - Updated dependencies [ad0b376]
19
+ - @ai-sdk/anthropic@4.0.0-beta.32
20
+
3
21
  ## 5.0.0-beta.52
4
22
 
5
23
  ### Patch Changes
package/README.md CHANGED
@@ -136,7 +136,6 @@ async function main() {
136
136
 
137
137
  console.log(result.text);
138
138
  console.log(result.providerMetadata?.anthropic);
139
- // e.g. { cacheCreationInputTokens: 2118, cacheReadInputTokens: 0 }
140
139
  }
141
140
 
142
141
  main().catch(console.error);
@@ -10,7 +10,7 @@ import {
10
10
  } from "@ai-sdk/provider-utils";
11
11
 
12
12
  // src/version.ts
13
- var VERSION = true ? "5.0.0-beta.52" : "0.0.0-test";
13
+ var VERSION = true ? "5.0.0-beta.54" : "0.0.0-test";
14
14
 
15
15
  // src/edge/google-vertex-auth-edge.ts
16
16
  var loadCredentials = async () => {
@@ -14,7 +14,7 @@ import {
14
14
  } from "@ai-sdk/provider-utils";
15
15
 
16
16
  // src/version.ts
17
- var VERSION = true ? "5.0.0-beta.52" : "0.0.0-test";
17
+ var VERSION = true ? "5.0.0-beta.54" : "0.0.0-test";
18
18
 
19
19
  // src/google-vertex-embedding-model.ts
20
20
  import {
package/dist/index.js CHANGED
@@ -35,7 +35,7 @@ import {
35
35
  } from "@ai-sdk/provider-utils";
36
36
 
37
37
  // src/version.ts
38
- var VERSION = true ? "5.0.0-beta.52" : "0.0.0-test";
38
+ var VERSION = true ? "5.0.0-beta.54" : "0.0.0-test";
39
39
 
40
40
  // src/google-vertex-embedding-model.ts
41
41
  import {
@@ -10,7 +10,7 @@ import {
10
10
  } from "@ai-sdk/provider-utils";
11
11
 
12
12
  // src/version.ts
13
- var VERSION = true ? "5.0.0-beta.52" : "0.0.0-test";
13
+ var VERSION = true ? "5.0.0-beta.54" : "0.0.0-test";
14
14
 
15
15
  // src/edge/google-vertex-auth-edge.ts
16
16
  var loadCredentials = async () => {
@@ -1538,13 +1538,12 @@ on how to integrate reasoning into your chatbot.
1538
1538
  In the messages and message parts, you can use the `providerOptions` property to set cache control breakpoints.
1539
1539
  You need to set the `anthropic` property in the `providerOptions` object to `{ cacheControl: { type: 'ephemeral' } }` to set a cache control breakpoint.
1540
1540
 
1541
- The cache creation input tokens are then returned in the `providerMetadata` object
1542
- for `generateText`, again under the `anthropic` property.
1543
- When you use `streamText`, the response contains a promise
1544
- that resolves to the metadata. Alternatively you can receive it in the
1545
- `onFinish` callback.
1541
+ Cache read and cache write (creation) token counts are returned on the standard
1542
+ `usage` object for both `generateText` and `streamText`. You can access them at
1543
+ `result.usage.inputTokenDetails.cacheReadTokens` and
1544
+ `result.usage.inputTokenDetails.cacheWriteTokens`.
1546
1545
 
1547
- ```ts highlight="8,18-20,29-30"
1546
+ ```ts highlight="8,18-20,29-32"
1548
1547
  import { vertexAnthropic } from '@ai-sdk/google-vertex/anthropic';
1549
1548
  import { generateText } from 'ai';
1550
1549
 
@@ -1571,8 +1570,11 @@ const result = await generateText({
1571
1570
  });
1572
1571
 
1573
1572
  console.log(result.text);
1574
- console.log(result.providerMetadata?.anthropic);
1575
- // e.g. { cacheCreationInputTokens: 2118, cacheReadInputTokens: 0 }
1573
+ console.log('Cache read tokens:', result.usage.inputTokenDetails.cacheReadTokens);
1574
+ console.log(
1575
+ 'Cache write tokens:',
1576
+ result.usage.inputTokenDetails.cacheWriteTokens,
1577
+ );
1576
1578
  ```
1577
1579
 
1578
1580
  You can also use cache control on system messages by providing multiple system messages at the head of your messages array:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-sdk/google-vertex",
3
- "version": "5.0.0-beta.52",
3
+ "version": "5.0.0-beta.54",
4
4
  "type": "module",
5
5
  "license": "Apache-2.0",
6
6
  "sideEffects": false,
@@ -60,11 +60,11 @@
60
60
  },
61
61
  "dependencies": {
62
62
  "google-auth-library": "^10.5.0",
63
- "@ai-sdk/anthropic": "4.0.0-beta.31",
64
63
  "@ai-sdk/google": "4.0.0-beta.41",
65
64
  "@ai-sdk/openai-compatible": "3.0.0-beta.27",
66
- "@ai-sdk/provider": "4.0.0-beta.12",
67
- "@ai-sdk/provider-utils": "5.0.0-beta.22"
65
+ "@ai-sdk/anthropic": "4.0.0-beta.33",
66
+ "@ai-sdk/provider-utils": "5.0.0-beta.22",
67
+ "@ai-sdk/provider": "4.0.0-beta.12"
68
68
  },
69
69
  "devDependencies": {
70
70
  "@types/node": "20.17.24",