@ai-sdk/anthropic 2.0.67 → 2.0.68

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,11 @@
1
1
  # @ai-sdk/anthropic
2
2
 
3
+ ## 2.0.68
4
+
5
+ ### Patch Changes
6
+
7
+ - 63bf188: feat(anthropic): expose anthropic.anthropicBeta to downstream providers
8
+
3
9
  ## 2.0.67
4
10
 
5
11
  ### Patch Changes
package/dist/index.d.mts CHANGED
@@ -201,6 +201,7 @@ declare const anthropicProviderOptions: z.ZodObject<{
201
201
  instructions: z.ZodOptional<z.ZodString>;
202
202
  }, z.core.$strip>]>>;
203
203
  }, z.core.$strip>>;
204
+ anthropicBeta: z.ZodOptional<z.ZodArray<z.ZodString>>;
204
205
  }, z.core.$strip>;
205
206
  type AnthropicProviderOptions = z.infer<typeof anthropicProviderOptions>;
206
207
 
package/dist/index.d.ts CHANGED
@@ -201,6 +201,7 @@ declare const anthropicProviderOptions: z.ZodObject<{
201
201
  instructions: z.ZodOptional<z.ZodString>;
202
202
  }, z.core.$strip>]>>;
203
203
  }, z.core.$strip>>;
204
+ anthropicBeta: z.ZodOptional<z.ZodArray<z.ZodString>>;
204
205
  }, z.core.$strip>;
205
206
  type AnthropicProviderOptions = z.infer<typeof anthropicProviderOptions>;
206
207
 
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.67" : "0.0.0-test";
34
+ var VERSION = true ? "2.0.68" : "0.0.0-test";
35
35
 
36
36
  // src/anthropic-messages-language-model.ts
37
37
  var import_provider3 = require("@ai-sdk/provider");
@@ -748,7 +748,12 @@ var anthropicProviderOptions = import_v43.z.object({
748
748
  })
749
749
  ])
750
750
  )
751
- }).optional()
751
+ }).optional(),
752
+ /**
753
+ * A set of beta features to enable.
754
+ * Allow a provider to receive the full `betas` set if it needs it.
755
+ */
756
+ anthropicBeta: import_v43.z.array(import_v43.z.string()).optional()
752
757
  });
753
758
 
754
759
  // src/anthropic-prepare-tools.ts
@@ -1942,7 +1947,7 @@ var AnthropicMessagesLanguageModel = class {
1942
1947
  toolChoice,
1943
1948
  providerOptions
1944
1949
  }) {
1945
- var _a, _b, _c, _d, _e;
1950
+ var _a, _b, _c, _d, _e, _f;
1946
1951
  const warnings = [];
1947
1952
  if (frequencyPenalty != null) {
1948
1953
  warnings.push({
@@ -2216,7 +2221,12 @@ var AnthropicMessagesLanguageModel = class {
2216
2221
  tool_choice: anthropicToolChoice
2217
2222
  },
2218
2223
  warnings: [...warnings, ...toolWarnings, ...cacheWarnings],
2219
- betas: /* @__PURE__ */ new Set([...betas, ...toolsBetas, ...userSuppliedBetas]),
2224
+ betas: /* @__PURE__ */ new Set([
2225
+ ...betas,
2226
+ ...toolsBetas,
2227
+ ...userSuppliedBetas,
2228
+ ...(_f = anthropicOptions == null ? void 0 : anthropicOptions.anthropicBeta) != null ? _f : []
2229
+ ]),
2220
2230
  usesJsonResponseTool: jsonResponseTool != null
2221
2231
  };
2222
2232
  }
@@ -2246,9 +2256,9 @@ var AnthropicMessagesLanguageModel = class {
2246
2256
  var _a, _b, _c;
2247
2257
  return (_c = (_b = (_a = this.config).buildRequestUrl) == null ? void 0 : _b.call(_a, this.config.baseURL, isStreaming)) != null ? _c : `${this.config.baseURL}/messages`;
2248
2258
  }
2249
- transformRequestBody(args) {
2259
+ transformRequestBody(args, betas) {
2250
2260
  var _a, _b, _c;
2251
- return (_c = (_b = (_a = this.config).transformRequestBody) == null ? void 0 : _b.call(_a, args)) != null ? _c : args;
2261
+ return (_c = (_b = (_a = this.config).transformRequestBody) == null ? void 0 : _b.call(_a, args, betas)) != null ? _c : args;
2252
2262
  }
2253
2263
  extractCitationDocuments(prompt) {
2254
2264
  const isCitationPart = (part) => {
@@ -2287,7 +2297,7 @@ var AnthropicMessagesLanguageModel = class {
2287
2297
  } = await (0, import_provider_utils11.postJsonToApi)({
2288
2298
  url: this.buildRequestUrl(false),
2289
2299
  headers: await this.getHeaders({ betas, headers: options.headers }),
2290
- body: this.transformRequestBody(args),
2300
+ body: this.transformRequestBody(args, betas),
2291
2301
  failedResponseHandler: anthropicFailedResponseHandler,
2292
2302
  successfulResponseHandler: (0, import_provider_utils11.createJsonResponseHandler)(
2293
2303
  anthropicMessagesResponseSchema
@@ -2612,7 +2622,7 @@ var AnthropicMessagesLanguageModel = class {
2612
2622
  const { responseHeaders, value: response } = await (0, import_provider_utils11.postJsonToApi)({
2613
2623
  url,
2614
2624
  headers: await this.getHeaders({ betas, headers: options.headers }),
2615
- body: this.transformRequestBody(body),
2625
+ body: this.transformRequestBody(body, betas),
2616
2626
  failedResponseHandler: anthropicFailedResponseHandler,
2617
2627
  successfulResponseHandler: (0, import_provider_utils11.createEventSourceResponseHandler)(
2618
2628
  anthropicMessagesChunkSchema