@ai-sdk/anthropic 2.0.67 → 2.0.69

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
@@ -11,7 +11,7 @@ import {
11
11
  } from "@ai-sdk/provider-utils";
12
12
 
13
13
  // src/version.ts
14
- var VERSION = true ? "2.0.67" : "0.0.0-test";
14
+ var VERSION = true ? "2.0.69" : "0.0.0-test";
15
15
 
16
16
  // src/anthropic-messages-language-model.ts
17
17
  import {
@@ -743,7 +743,12 @@ var anthropicProviderOptions = z3.object({
743
743
  })
744
744
  ])
745
745
  )
746
- }).optional()
746
+ }).optional(),
747
+ /**
748
+ * A set of beta features to enable.
749
+ * Allow a provider to receive the full `betas` set if it needs it.
750
+ */
751
+ anthropicBeta: z3.array(z3.string()).optional()
747
752
  });
748
753
 
749
754
  // src/anthropic-prepare-tools.ts
@@ -1961,7 +1966,7 @@ var AnthropicMessagesLanguageModel = class {
1961
1966
  toolChoice,
1962
1967
  providerOptions
1963
1968
  }) {
1964
- var _a, _b, _c, _d, _e;
1969
+ var _a, _b, _c, _d, _e, _f;
1965
1970
  const warnings = [];
1966
1971
  if (frequencyPenalty != null) {
1967
1972
  warnings.push({
@@ -2235,7 +2240,12 @@ var AnthropicMessagesLanguageModel = class {
2235
2240
  tool_choice: anthropicToolChoice
2236
2241
  },
2237
2242
  warnings: [...warnings, ...toolWarnings, ...cacheWarnings],
2238
- betas: /* @__PURE__ */ new Set([...betas, ...toolsBetas, ...userSuppliedBetas]),
2243
+ betas: /* @__PURE__ */ new Set([
2244
+ ...betas,
2245
+ ...toolsBetas,
2246
+ ...userSuppliedBetas,
2247
+ ...(_f = anthropicOptions == null ? void 0 : anthropicOptions.anthropicBeta) != null ? _f : []
2248
+ ]),
2239
2249
  usesJsonResponseTool: jsonResponseTool != null
2240
2250
  };
2241
2251
  }
@@ -2265,9 +2275,9 @@ var AnthropicMessagesLanguageModel = class {
2265
2275
  var _a, _b, _c;
2266
2276
  return (_c = (_b = (_a = this.config).buildRequestUrl) == null ? void 0 : _b.call(_a, this.config.baseURL, isStreaming)) != null ? _c : `${this.config.baseURL}/messages`;
2267
2277
  }
2268
- transformRequestBody(args) {
2278
+ transformRequestBody(args, betas) {
2269
2279
  var _a, _b, _c;
2270
- return (_c = (_b = (_a = this.config).transformRequestBody) == null ? void 0 : _b.call(_a, args)) != null ? _c : args;
2280
+ return (_c = (_b = (_a = this.config).transformRequestBody) == null ? void 0 : _b.call(_a, args, betas)) != null ? _c : args;
2271
2281
  }
2272
2282
  extractCitationDocuments(prompt) {
2273
2283
  const isCitationPart = (part) => {
@@ -2306,7 +2316,7 @@ var AnthropicMessagesLanguageModel = class {
2306
2316
  } = await postJsonToApi({
2307
2317
  url: this.buildRequestUrl(false),
2308
2318
  headers: await this.getHeaders({ betas, headers: options.headers }),
2309
- body: this.transformRequestBody(args),
2319
+ body: this.transformRequestBody(args, betas),
2310
2320
  failedResponseHandler: anthropicFailedResponseHandler,
2311
2321
  successfulResponseHandler: createJsonResponseHandler(
2312
2322
  anthropicMessagesResponseSchema
@@ -2631,7 +2641,7 @@ var AnthropicMessagesLanguageModel = class {
2631
2641
  const { responseHeaders, value: response } = await postJsonToApi({
2632
2642
  url,
2633
2643
  headers: await this.getHeaders({ betas, headers: options.headers }),
2634
- body: this.transformRequestBody(body),
2644
+ body: this.transformRequestBody(body, betas),
2635
2645
  failedResponseHandler: anthropicFailedResponseHandler,
2636
2646
  successfulResponseHandler: createEventSourceResponseHandler(
2637
2647
  anthropicMessagesChunkSchema