@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/dist/internal/index.js
CHANGED
|
@@ -510,8 +510,10 @@ var anthropicMessagesChunkSchema = (0, import_provider_utils2.lazySchema)(
|
|
|
510
510
|
}).nullish()
|
|
511
511
|
}),
|
|
512
512
|
usage: import_v42.z.looseObject({
|
|
513
|
+
input_tokens: import_v42.z.number().nullish(),
|
|
513
514
|
output_tokens: import_v42.z.number(),
|
|
514
|
-
cache_creation_input_tokens: import_v42.z.number().nullish()
|
|
515
|
+
cache_creation_input_tokens: import_v42.z.number().nullish(),
|
|
516
|
+
cache_read_input_tokens: import_v42.z.number().nullish()
|
|
515
517
|
})
|
|
516
518
|
}),
|
|
517
519
|
import_v42.z.object({
|
|
@@ -2734,8 +2736,17 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
2734
2736
|
return;
|
|
2735
2737
|
}
|
|
2736
2738
|
case "message_delta": {
|
|
2739
|
+
if (value.usage.input_tokens != null && usage.inputTokens !== value.usage.input_tokens) {
|
|
2740
|
+
usage.inputTokens = value.usage.input_tokens;
|
|
2741
|
+
}
|
|
2737
2742
|
usage.outputTokens = value.usage.output_tokens;
|
|
2738
|
-
|
|
2743
|
+
if (value.usage.cache_read_input_tokens != null) {
|
|
2744
|
+
usage.cachedInputTokens = value.usage.cache_read_input_tokens;
|
|
2745
|
+
}
|
|
2746
|
+
if (value.usage.cache_creation_input_tokens != null) {
|
|
2747
|
+
cacheCreationInputTokens = value.usage.cache_creation_input_tokens;
|
|
2748
|
+
}
|
|
2749
|
+
usage.totalTokens = ((_f = usage.inputTokens) != null ? _f : 0) + ((_g = usage.outputTokens) != null ? _g : 0);
|
|
2739
2750
|
finishReason = mapAnthropicStopReason({
|
|
2740
2751
|
finishReason: value.delta.stop_reason,
|
|
2741
2752
|
isJsonResponseFromTool: usesJsonResponseTool
|