@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.
@@ -728,7 +728,12 @@ var anthropicProviderOptions = z3.object({
728
728
  })
729
729
  ])
730
730
  )
731
- }).optional()
731
+ }).optional(),
732
+ /**
733
+ * A set of beta features to enable.
734
+ * Allow a provider to receive the full `betas` set if it needs it.
735
+ */
736
+ anthropicBeta: z3.array(z3.string()).optional()
732
737
  });
733
738
 
734
739
  // src/anthropic-prepare-tools.ts
@@ -1946,7 +1951,7 @@ var AnthropicMessagesLanguageModel = class {
1946
1951
  toolChoice,
1947
1952
  providerOptions
1948
1953
  }) {
1949
- var _a, _b, _c, _d, _e;
1954
+ var _a, _b, _c, _d, _e, _f;
1950
1955
  const warnings = [];
1951
1956
  if (frequencyPenalty != null) {
1952
1957
  warnings.push({
@@ -2220,7 +2225,12 @@ var AnthropicMessagesLanguageModel = class {
2220
2225
  tool_choice: anthropicToolChoice
2221
2226
  },
2222
2227
  warnings: [...warnings, ...toolWarnings, ...cacheWarnings],
2223
- betas: /* @__PURE__ */ new Set([...betas, ...toolsBetas, ...userSuppliedBetas]),
2228
+ betas: /* @__PURE__ */ new Set([
2229
+ ...betas,
2230
+ ...toolsBetas,
2231
+ ...userSuppliedBetas,
2232
+ ...(_f = anthropicOptions == null ? void 0 : anthropicOptions.anthropicBeta) != null ? _f : []
2233
+ ]),
2224
2234
  usesJsonResponseTool: jsonResponseTool != null
2225
2235
  };
2226
2236
  }
@@ -2250,9 +2260,9 @@ var AnthropicMessagesLanguageModel = class {
2250
2260
  var _a, _b, _c;
2251
2261
  return (_c = (_b = (_a = this.config).buildRequestUrl) == null ? void 0 : _b.call(_a, this.config.baseURL, isStreaming)) != null ? _c : `${this.config.baseURL}/messages`;
2252
2262
  }
2253
- transformRequestBody(args) {
2263
+ transformRequestBody(args, betas) {
2254
2264
  var _a, _b, _c;
2255
- return (_c = (_b = (_a = this.config).transformRequestBody) == null ? void 0 : _b.call(_a, args)) != null ? _c : args;
2265
+ return (_c = (_b = (_a = this.config).transformRequestBody) == null ? void 0 : _b.call(_a, args, betas)) != null ? _c : args;
2256
2266
  }
2257
2267
  extractCitationDocuments(prompt) {
2258
2268
  const isCitationPart = (part) => {
@@ -2291,7 +2301,7 @@ var AnthropicMessagesLanguageModel = class {
2291
2301
  } = await postJsonToApi({
2292
2302
  url: this.buildRequestUrl(false),
2293
2303
  headers: await this.getHeaders({ betas, headers: options.headers }),
2294
- body: this.transformRequestBody(args),
2304
+ body: this.transformRequestBody(args, betas),
2295
2305
  failedResponseHandler: anthropicFailedResponseHandler,
2296
2306
  successfulResponseHandler: createJsonResponseHandler(
2297
2307
  anthropicMessagesResponseSchema
@@ -2616,7 +2626,7 @@ var AnthropicMessagesLanguageModel = class {
2616
2626
  const { responseHeaders, value: response } = await postJsonToApi({
2617
2627
  url,
2618
2628
  headers: await this.getHeaders({ betas, headers: options.headers }),
2619
- body: this.transformRequestBody(body),
2629
+ body: this.transformRequestBody(body, betas),
2620
2630
  failedResponseHandler: anthropicFailedResponseHandler,
2621
2631
  successfulResponseHandler: createEventSourceResponseHandler(
2622
2632
  anthropicMessagesChunkSchema