@ai-sdk/anthropic 3.0.55 → 3.0.56

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
@@ -12,7 +12,7 @@ import {
12
12
  } from "@ai-sdk/provider-utils";
13
13
 
14
14
  // src/version.ts
15
- var VERSION = true ? "3.0.55" : "0.0.0-test";
15
+ var VERSION = true ? "3.0.56" : "0.0.0-test";
16
16
 
17
17
  // src/anthropic-messages-language-model.ts
18
18
  import {
@@ -912,6 +912,11 @@ var anthropicLanguageModelOptions = z3.object({
912
912
  * Only supported with claude-opus-4-6.
913
913
  */
914
914
  speed: z3.enum(["fast", "standard"]).optional(),
915
+ /**
916
+ * A set of beta features to enable.
917
+ * Allow a provider to receive the full `betas` set if it needs it.
918
+ */
919
+ anthropicBeta: z3.array(z3.string()).optional(),
915
920
  contextManagement: z3.object({
916
921
  edits: z3.array(
917
922
  z3.discriminatedUnion("type", [
@@ -2902,7 +2907,7 @@ var AnthropicMessagesLanguageModel = class {
2902
2907
  providerOptions,
2903
2908
  stream
2904
2909
  }) {
2905
- var _a, _b, _c, _d, _e, _f;
2910
+ var _a, _b, _c, _d, _e, _f, _g;
2906
2911
  const warnings = [];
2907
2912
  if (frequencyPenalty != null) {
2908
2913
  warnings.push({ type: "unsupported", feature: "frequencyPenalty" });
@@ -3242,7 +3247,12 @@ var AnthropicMessagesLanguageModel = class {
3242
3247
  // do not send when not streaming
3243
3248
  },
3244
3249
  warnings: [...warnings, ...toolWarnings, ...cacheWarnings],
3245
- betas: /* @__PURE__ */ new Set([...betas, ...toolsBetas, ...userSuppliedBetas]),
3250
+ betas: /* @__PURE__ */ new Set([
3251
+ ...betas,
3252
+ ...toolsBetas,
3253
+ ...userSuppliedBetas,
3254
+ ...(_g = anthropicOptions == null ? void 0 : anthropicOptions.anthropicBeta) != null ? _g : []
3255
+ ]),
3246
3256
  usesJsonResponseTool: jsonResponseTool != null,
3247
3257
  toolNameMapping,
3248
3258
  providerOptionsName,
@@ -3275,9 +3285,9 @@ var AnthropicMessagesLanguageModel = class {
3275
3285
  var _a, _b, _c;
3276
3286
  return (_c = (_b = (_a = this.config).buildRequestUrl) == null ? void 0 : _b.call(_a, this.config.baseURL, isStreaming)) != null ? _c : `${this.config.baseURL}/messages`;
3277
3287
  }
3278
- transformRequestBody(args) {
3288
+ transformRequestBody(args, betas) {
3279
3289
  var _a, _b, _c;
3280
- return (_c = (_b = (_a = this.config).transformRequestBody) == null ? void 0 : _b.call(_a, args)) != null ? _c : args;
3290
+ return (_c = (_b = (_a = this.config).transformRequestBody) == null ? void 0 : _b.call(_a, args, betas)) != null ? _c : args;
3281
3291
  }
3282
3292
  extractCitationDocuments(prompt) {
3283
3293
  const isCitationPart = (part) => {
@@ -3330,7 +3340,7 @@ var AnthropicMessagesLanguageModel = class {
3330
3340
  } = await postJsonToApi({
3331
3341
  url: this.buildRequestUrl(false),
3332
3342
  headers: await this.getHeaders({ betas, headers: options.headers }),
3333
- body: this.transformRequestBody(args),
3343
+ body: this.transformRequestBody(args, betas),
3334
3344
  failedResponseHandler: anthropicFailedResponseHandler,
3335
3345
  successfulResponseHandler: createJsonResponseHandler(
3336
3346
  anthropicMessagesResponseSchema
@@ -3750,7 +3760,7 @@ var AnthropicMessagesLanguageModel = class {
3750
3760
  const { responseHeaders, value: response } = await postJsonToApi({
3751
3761
  url,
3752
3762
  headers: await this.getHeaders({ betas, headers: options.headers }),
3753
- body: this.transformRequestBody(body),
3763
+ body: this.transformRequestBody(body, betas),
3754
3764
  failedResponseHandler: anthropicFailedResponseHandler,
3755
3765
  successfulResponseHandler: createEventSourceResponseHandler(
3756
3766
  anthropicMessagesChunkSchema