@ai-sdk/anthropic 3.0.55 → 3.0.57
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 +14 -0
- package/dist/index.d.mts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +17 -7
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +17 -7
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.d.mts +1 -1
- package/dist/internal/index.d.ts +1 -1
- package/dist/internal/index.js +16 -6
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +16 -6
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +2 -2
- package/src/anthropic-messages-language-model.ts +17 -6
- package/src/anthropic-messages-options.ts +6 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @ai-sdk/anthropic
|
|
2
2
|
|
|
3
|
+
## 3.0.57
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [824b295]
|
|
8
|
+
- @ai-sdk/provider-utils@4.0.18
|
|
9
|
+
|
|
10
|
+
## 3.0.56
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- e49c34d: feat(anthropic): expose anthropic.anthropicBeta to downstream providers
|
|
15
|
+
- e49c34d: feat(anthropic): expose anthropic.anthropicBeta to downstream provider
|
|
16
|
+
|
|
3
17
|
## 3.0.55
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
package/dist/index.d.mts
CHANGED
|
@@ -178,6 +178,7 @@ declare const anthropicLanguageModelOptions: z.ZodObject<{
|
|
|
178
178
|
fast: "fast";
|
|
179
179
|
standard: "standard";
|
|
180
180
|
}>>;
|
|
181
|
+
anthropicBeta: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
181
182
|
contextManagement: z.ZodOptional<z.ZodObject<{
|
|
182
183
|
edits: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
183
184
|
type: z.ZodLiteral<"clear_tool_uses_20250919">;
|
package/dist/index.d.ts
CHANGED
|
@@ -178,6 +178,7 @@ declare const anthropicLanguageModelOptions: z.ZodObject<{
|
|
|
178
178
|
fast: "fast";
|
|
179
179
|
standard: "standard";
|
|
180
180
|
}>>;
|
|
181
|
+
anthropicBeta: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
181
182
|
contextManagement: z.ZodOptional<z.ZodObject<{
|
|
182
183
|
edits: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
183
184
|
type: z.ZodLiteral<"clear_tool_uses_20250919">;
|
package/dist/index.js
CHANGED
|
@@ -32,7 +32,7 @@ var import_provider4 = require("@ai-sdk/provider");
|
|
|
32
32
|
var import_provider_utils26 = require("@ai-sdk/provider-utils");
|
|
33
33
|
|
|
34
34
|
// src/version.ts
|
|
35
|
-
var VERSION = true ? "3.0.
|
|
35
|
+
var VERSION = true ? "3.0.57" : "0.0.0-test";
|
|
36
36
|
|
|
37
37
|
// src/anthropic-messages-language-model.ts
|
|
38
38
|
var import_provider3 = require("@ai-sdk/provider");
|
|
@@ -917,6 +917,11 @@ var anthropicLanguageModelOptions = import_v43.z.object({
|
|
|
917
917
|
* Only supported with claude-opus-4-6.
|
|
918
918
|
*/
|
|
919
919
|
speed: import_v43.z.enum(["fast", "standard"]).optional(),
|
|
920
|
+
/**
|
|
921
|
+
* A set of beta features to enable.
|
|
922
|
+
* Allow a provider to receive the full `betas` set if it needs it.
|
|
923
|
+
*/
|
|
924
|
+
anthropicBeta: import_v43.z.array(import_v43.z.string()).optional(),
|
|
920
925
|
contextManagement: import_v43.z.object({
|
|
921
926
|
edits: import_v43.z.array(
|
|
922
927
|
import_v43.z.discriminatedUnion("type", [
|
|
@@ -2865,7 +2870,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
2865
2870
|
providerOptions,
|
|
2866
2871
|
stream
|
|
2867
2872
|
}) {
|
|
2868
|
-
var _a, _b, _c, _d, _e, _f;
|
|
2873
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
2869
2874
|
const warnings = [];
|
|
2870
2875
|
if (frequencyPenalty != null) {
|
|
2871
2876
|
warnings.push({ type: "unsupported", feature: "frequencyPenalty" });
|
|
@@ -3205,7 +3210,12 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3205
3210
|
// do not send when not streaming
|
|
3206
3211
|
},
|
|
3207
3212
|
warnings: [...warnings, ...toolWarnings, ...cacheWarnings],
|
|
3208
|
-
betas: /* @__PURE__ */ new Set([
|
|
3213
|
+
betas: /* @__PURE__ */ new Set([
|
|
3214
|
+
...betas,
|
|
3215
|
+
...toolsBetas,
|
|
3216
|
+
...userSuppliedBetas,
|
|
3217
|
+
...(_g = anthropicOptions == null ? void 0 : anthropicOptions.anthropicBeta) != null ? _g : []
|
|
3218
|
+
]),
|
|
3209
3219
|
usesJsonResponseTool: jsonResponseTool != null,
|
|
3210
3220
|
toolNameMapping,
|
|
3211
3221
|
providerOptionsName,
|
|
@@ -3238,9 +3248,9 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3238
3248
|
var _a, _b, _c;
|
|
3239
3249
|
return (_c = (_b = (_a = this.config).buildRequestUrl) == null ? void 0 : _b.call(_a, this.config.baseURL, isStreaming)) != null ? _c : `${this.config.baseURL}/messages`;
|
|
3240
3250
|
}
|
|
3241
|
-
transformRequestBody(args) {
|
|
3251
|
+
transformRequestBody(args, betas) {
|
|
3242
3252
|
var _a, _b, _c;
|
|
3243
|
-
return (_c = (_b = (_a = this.config).transformRequestBody) == null ? void 0 : _b.call(_a, args)) != null ? _c : args;
|
|
3253
|
+
return (_c = (_b = (_a = this.config).transformRequestBody) == null ? void 0 : _b.call(_a, args, betas)) != null ? _c : args;
|
|
3244
3254
|
}
|
|
3245
3255
|
extractCitationDocuments(prompt) {
|
|
3246
3256
|
const isCitationPart = (part) => {
|
|
@@ -3293,7 +3303,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3293
3303
|
} = await (0, import_provider_utils15.postJsonToApi)({
|
|
3294
3304
|
url: this.buildRequestUrl(false),
|
|
3295
3305
|
headers: await this.getHeaders({ betas, headers: options.headers }),
|
|
3296
|
-
body: this.transformRequestBody(args),
|
|
3306
|
+
body: this.transformRequestBody(args, betas),
|
|
3297
3307
|
failedResponseHandler: anthropicFailedResponseHandler,
|
|
3298
3308
|
successfulResponseHandler: (0, import_provider_utils15.createJsonResponseHandler)(
|
|
3299
3309
|
anthropicMessagesResponseSchema
|
|
@@ -3713,7 +3723,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
3713
3723
|
const { responseHeaders, value: response } = await (0, import_provider_utils15.postJsonToApi)({
|
|
3714
3724
|
url,
|
|
3715
3725
|
headers: await this.getHeaders({ betas, headers: options.headers }),
|
|
3716
|
-
body: this.transformRequestBody(body),
|
|
3726
|
+
body: this.transformRequestBody(body, betas),
|
|
3717
3727
|
failedResponseHandler: anthropicFailedResponseHandler,
|
|
3718
3728
|
successfulResponseHandler: (0, import_provider_utils15.createEventSourceResponseHandler)(
|
|
3719
3729
|
anthropicMessagesChunkSchema
|