@ai-sdk/anthropic 2.0.56 → 2.0.58
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 +16 -0
- package/dist/index.js +14 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +14 -3
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.js +13 -2
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +13 -2
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @ai-sdk/anthropic
|
|
2
2
|
|
|
3
|
+
## 2.0.58
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 8479fe8: trigger for backport release
|
|
8
|
+
- 008ce2f: fix `input_tokens` compatibility
|
|
9
|
+
|
|
10
|
+
## 2.0.57
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- 526fe8d: fix: trigger new release for `@ai-v5` dist-tag
|
|
15
|
+
- Updated dependencies [526fe8d]
|
|
16
|
+
- @ai-sdk/provider@2.0.1
|
|
17
|
+
- @ai-sdk/provider-utils@3.0.20
|
|
18
|
+
|
|
3
19
|
## 2.0.56
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
package/dist/index.js
CHANGED
|
@@ -31,7 +31,7 @@ var import_provider4 = require("@ai-sdk/provider");
|
|
|
31
31
|
var import_provider_utils20 = require("@ai-sdk/provider-utils");
|
|
32
32
|
|
|
33
33
|
// src/version.ts
|
|
34
|
-
var VERSION = true ? "2.0.
|
|
34
|
+
var VERSION = true ? "2.0.58" : "0.0.0-test";
|
|
35
35
|
|
|
36
36
|
// src/anthropic-messages-language-model.ts
|
|
37
37
|
var import_provider3 = require("@ai-sdk/provider");
|
|
@@ -517,8 +517,10 @@ var anthropicMessagesChunkSchema = (0, import_provider_utils2.lazySchema)(
|
|
|
517
517
|
}).nullish()
|
|
518
518
|
}),
|
|
519
519
|
usage: import_v42.z.looseObject({
|
|
520
|
+
input_tokens: import_v42.z.number().nullish(),
|
|
520
521
|
output_tokens: import_v42.z.number(),
|
|
521
|
-
cache_creation_input_tokens: import_v42.z.number().nullish()
|
|
522
|
+
cache_creation_input_tokens: import_v42.z.number().nullish(),
|
|
523
|
+
cache_read_input_tokens: import_v42.z.number().nullish()
|
|
522
524
|
})
|
|
523
525
|
}),
|
|
524
526
|
import_v42.z.object({
|
|
@@ -2741,8 +2743,17 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
2741
2743
|
return;
|
|
2742
2744
|
}
|
|
2743
2745
|
case "message_delta": {
|
|
2746
|
+
if (value.usage.input_tokens != null && usage.inputTokens !== value.usage.input_tokens) {
|
|
2747
|
+
usage.inputTokens = value.usage.input_tokens;
|
|
2748
|
+
}
|
|
2744
2749
|
usage.outputTokens = value.usage.output_tokens;
|
|
2745
|
-
|
|
2750
|
+
if (value.usage.cache_read_input_tokens != null) {
|
|
2751
|
+
usage.cachedInputTokens = value.usage.cache_read_input_tokens;
|
|
2752
|
+
}
|
|
2753
|
+
if (value.usage.cache_creation_input_tokens != null) {
|
|
2754
|
+
cacheCreationInputTokens = value.usage.cache_creation_input_tokens;
|
|
2755
|
+
}
|
|
2756
|
+
usage.totalTokens = ((_f = usage.inputTokens) != null ? _f : 0) + ((_g = usage.outputTokens) != null ? _g : 0);
|
|
2746
2757
|
finishReason = mapAnthropicStopReason({
|
|
2747
2758
|
finishReason: value.delta.stop_reason,
|
|
2748
2759
|
isJsonResponseFromTool: usesJsonResponseTool
|