@ai-sdk/anthropic 2.0.16 → 2.0.18

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/dist/index.mjs CHANGED
@@ -5,9 +5,13 @@ import {
5
5
  import {
6
6
  generateId as generateId2,
7
7
  loadApiKey,
8
- withoutTrailingSlash
8
+ withoutTrailingSlash,
9
+ withUserAgentSuffix
9
10
  } from "@ai-sdk/provider-utils";
10
11
 
12
+ // src/version.ts
13
+ var VERSION = true ? "2.0.18" : "0.0.0-test";
14
+
11
15
  // src/anthropic-messages-language-model.ts
12
16
  import {
13
17
  UnsupportedFunctionalityError as UnsupportedFunctionalityError3
@@ -73,7 +77,15 @@ var anthropicProviderOptions = z2.object({
73
77
  * Whether to disable parallel function calling during tool use. Default is false.
74
78
  * When set to true, Claude will use at most one tool per response.
75
79
  */
76
- disableParallelToolUse: z2.boolean().optional()
80
+ disableParallelToolUse: z2.boolean().optional(),
81
+ /**
82
+ * Cache control settings for this message.
83
+ * See https://docs.anthropic.com/en/docs/build-with-claude/prompt-caching
84
+ */
85
+ cacheControl: z2.object({
86
+ type: z2.literal("ephemeral"),
87
+ ttl: z2.union([z2.literal("5m"), z2.literal("1h")]).optional()
88
+ }).optional()
77
89
  });
78
90
 
79
91
  // src/anthropic-prepare-tools.ts
@@ -2077,15 +2089,18 @@ var anthropicTools = {
2077
2089
  function createAnthropic(options = {}) {
2078
2090
  var _a;
2079
2091
  const baseURL = (_a = withoutTrailingSlash(options.baseURL)) != null ? _a : "https://api.anthropic.com/v1";
2080
- const getHeaders = () => ({
2081
- "anthropic-version": "2023-06-01",
2082
- "x-api-key": loadApiKey({
2083
- apiKey: options.apiKey,
2084
- environmentVariableName: "ANTHROPIC_API_KEY",
2085
- description: "Anthropic"
2086
- }),
2087
- ...options.headers
2088
- });
2092
+ const getHeaders = () => withUserAgentSuffix(
2093
+ {
2094
+ "anthropic-version": "2023-06-01",
2095
+ "x-api-key": loadApiKey({
2096
+ apiKey: options.apiKey,
2097
+ environmentVariableName: "ANTHROPIC_API_KEY",
2098
+ description: "Anthropic"
2099
+ }),
2100
+ ...options.headers
2101
+ },
2102
+ `ai-sdk/anthropic/${VERSION}`
2103
+ );
2089
2104
  const createChatModel = (modelId) => {
2090
2105
  var _a2;
2091
2106
  return new AnthropicMessagesLanguageModel(modelId, {
@@ -2121,6 +2136,7 @@ function createAnthropic(options = {}) {
2121
2136
  }
2122
2137
  var anthropic = createAnthropic();
2123
2138
  export {
2139
+ VERSION,
2124
2140
  anthropic,
2125
2141
  createAnthropic
2126
2142
  };