@ai-sdk/anthropic 3.0.45 → 3.0.47

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,17 @@
1
1
  # @ai-sdk/anthropic
2
2
 
3
+ ## 3.0.47
4
+
5
+ ### Patch Changes
6
+
7
+ - 17978c6: Pass `cacheControl` provider option as top-level `cache_control` in Anthropic API request body to support automatic caching.
8
+
9
+ ## 3.0.46
10
+
11
+ ### Patch Changes
12
+
13
+ - b094c07: fix compaction_delta streaming schema to allow null content
14
+
3
15
  ## 3.0.45
4
16
 
5
17
  ### Patch Changes
package/dist/index.js CHANGED
@@ -32,7 +32,7 @@ var import_provider4 = require("@ai-sdk/provider");
32
32
  var import_provider_utils23 = require("@ai-sdk/provider-utils");
33
33
 
34
34
  // src/version.ts
35
- var VERSION = true ? "3.0.45" : "0.0.0-test";
35
+ var VERSION = true ? "3.0.47" : "0.0.0-test";
36
36
 
37
37
  // src/anthropic-messages-language-model.ts
38
38
  var import_provider3 = require("@ai-sdk/provider");
@@ -628,7 +628,7 @@ var anthropicMessagesChunkSchema = (0, import_provider_utils2.lazySchema)(
628
628
  }),
629
629
  import_v42.z.object({
630
630
  type: import_v42.z.literal("compaction_delta"),
631
- content: import_v42.z.string()
631
+ content: import_v42.z.string().nullish()
632
632
  }),
633
633
  import_v42.z.object({
634
634
  type: import_v42.z.literal("citations_delta"),
@@ -2648,6 +2648,9 @@ var AnthropicMessagesLanguageModel = class {
2648
2648
  ...(anthropicOptions == null ? void 0 : anthropicOptions.speed) && {
2649
2649
  speed: anthropicOptions.speed
2650
2650
  },
2651
+ ...(anthropicOptions == null ? void 0 : anthropicOptions.cacheControl) && {
2652
+ cache_control: anthropicOptions.cacheControl
2653
+ },
2651
2654
  // structured output:
2652
2655
  ...useStructuredOutput && (responseFormat == null ? void 0 : responseFormat.type) === "json" && responseFormat.schema != null && {
2653
2656
  output_format: {
@@ -3834,11 +3837,13 @@ var AnthropicMessagesLanguageModel = class {
3834
3837
  return;
3835
3838
  }
3836
3839
  case "compaction_delta": {
3837
- controller.enqueue({
3838
- type: "text-delta",
3839
- id: String(value.index),
3840
- delta: value.delta.content
3841
- });
3840
+ if (value.delta.content != null) {
3841
+ controller.enqueue({
3842
+ type: "text-delta",
3843
+ id: String(value.index),
3844
+ delta: value.delta.content
3845
+ });
3846
+ }
3842
3847
  return;
3843
3848
  }
3844
3849
  case "input_json_delta": {