@ai-sdk/anthropic 2.0.69 → 2.0.71
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 +12 -0
- package/dist/index.d.mts +3 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +29 -8
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +26 -5
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.d.mts +1 -0
- package/dist/internal/index.d.ts +1 -0
- package/dist/internal/index.js +28 -7
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +25 -4
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +1 -3
package/dist/internal/index.d.ts
CHANGED
package/dist/internal/index.js
CHANGED
|
@@ -18,13 +18,13 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
19
|
|
|
20
20
|
// src/internal/index.ts
|
|
21
|
-
var
|
|
22
|
-
__export(
|
|
21
|
+
var index_exports = {};
|
|
22
|
+
__export(index_exports, {
|
|
23
23
|
AnthropicMessagesLanguageModel: () => AnthropicMessagesLanguageModel,
|
|
24
24
|
anthropicTools: () => anthropicTools,
|
|
25
25
|
prepareTools: () => prepareTools
|
|
26
26
|
});
|
|
27
|
-
module.exports = __toCommonJS(
|
|
27
|
+
module.exports = __toCommonJS(index_exports);
|
|
28
28
|
|
|
29
29
|
// src/anthropic-messages-language-model.ts
|
|
30
30
|
var import_provider3 = require("@ai-sdk/provider");
|
|
@@ -666,6 +666,20 @@ var anthropicProviderOptions = import_v43.z.object({
|
|
|
666
666
|
type: import_v43.z.literal("ephemeral"),
|
|
667
667
|
ttl: import_v43.z.union([import_v43.z.literal("5m"), import_v43.z.literal("1h")]).optional()
|
|
668
668
|
}).optional(),
|
|
669
|
+
/**
|
|
670
|
+
* Metadata to include with the request.
|
|
671
|
+
*
|
|
672
|
+
* See https://platform.claude.com/docs/en/api/messages/create for details.
|
|
673
|
+
*/
|
|
674
|
+
metadata: import_v43.z.object({
|
|
675
|
+
/**
|
|
676
|
+
* An external identifier for the user associated with the request.
|
|
677
|
+
*
|
|
678
|
+
* Should be a UUID, hash value, or other opaque identifier.
|
|
679
|
+
* Must not contain PII (name, email, phone number, etc.).
|
|
680
|
+
*/
|
|
681
|
+
userId: import_v43.z.string().optional()
|
|
682
|
+
}).optional(),
|
|
669
683
|
/**
|
|
670
684
|
* Agent Skills configuration. Skills enable Claude to perform specialized tasks
|
|
671
685
|
* like document processing (PPTX, DOCX, PDF, XLSX) and data analysis.
|
|
@@ -941,6 +955,7 @@ async function prepareTools({
|
|
|
941
955
|
disableParallelToolUse,
|
|
942
956
|
cacheControlValidator
|
|
943
957
|
}) {
|
|
958
|
+
var _a;
|
|
944
959
|
tools = (tools == null ? void 0 : tools.length) ? tools : void 0;
|
|
945
960
|
const toolWarnings = [];
|
|
946
961
|
const betas = /* @__PURE__ */ new Set();
|
|
@@ -956,11 +971,14 @@ async function prepareTools({
|
|
|
956
971
|
type: "tool definition",
|
|
957
972
|
canCache: true
|
|
958
973
|
});
|
|
974
|
+
const anthropicOptions = (_a = tool.providerOptions) == null ? void 0 : _a.anthropic;
|
|
975
|
+
const eagerInputStreaming = anthropicOptions == null ? void 0 : anthropicOptions.eagerInputStreaming;
|
|
959
976
|
anthropicTools2.push({
|
|
960
977
|
name: tool.name,
|
|
961
978
|
description: tool.description,
|
|
962
979
|
input_schema: tool.inputSchema,
|
|
963
|
-
cache_control: cacheControl
|
|
980
|
+
cache_control: cacheControl,
|
|
981
|
+
...eagerInputStreaming ? { eager_input_streaming: true } : {}
|
|
964
982
|
});
|
|
965
983
|
break;
|
|
966
984
|
}
|
|
@@ -1940,7 +1958,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
1940
1958
|
toolChoice,
|
|
1941
1959
|
providerOptions
|
|
1942
1960
|
}) {
|
|
1943
|
-
var _a, _b, _c, _d, _e, _f;
|
|
1961
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
1944
1962
|
const warnings = [];
|
|
1945
1963
|
if (frequencyPenalty != null) {
|
|
1946
1964
|
warnings.push({
|
|
@@ -2044,6 +2062,9 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
2044
2062
|
...(anthropicOptions == null ? void 0 : anthropicOptions.cacheControl) && {
|
|
2045
2063
|
cache_control: anthropicOptions.cacheControl
|
|
2046
2064
|
},
|
|
2065
|
+
...((_e = anthropicOptions == null ? void 0 : anthropicOptions.metadata) == null ? void 0 : _e.userId) != null && {
|
|
2066
|
+
metadata: { user_id: anthropicOptions.metadata.userId }
|
|
2067
|
+
},
|
|
2047
2068
|
// structured output:
|
|
2048
2069
|
...useStructuredOutput && (responseFormat == null ? void 0 : responseFormat.type) === "json" && responseFormat.schema != null && {
|
|
2049
2070
|
output_format: {
|
|
@@ -2055,7 +2076,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
2055
2076
|
...(anthropicOptions == null ? void 0 : anthropicOptions.container) && {
|
|
2056
2077
|
container: {
|
|
2057
2078
|
id: anthropicOptions.container.id,
|
|
2058
|
-
skills: (
|
|
2079
|
+
skills: (_f = anthropicOptions.container.skills) == null ? void 0 : _f.map((skill) => ({
|
|
2059
2080
|
type: skill.type,
|
|
2060
2081
|
skill_id: skill.skillId,
|
|
2061
2082
|
version: skill.version
|
|
@@ -2218,7 +2239,7 @@ var AnthropicMessagesLanguageModel = class {
|
|
|
2218
2239
|
...betas,
|
|
2219
2240
|
...toolsBetas,
|
|
2220
2241
|
...userSuppliedBetas,
|
|
2221
|
-
...(
|
|
2242
|
+
...(_g = anthropicOptions == null ? void 0 : anthropicOptions.anthropicBeta) != null ? _g : []
|
|
2222
2243
|
]),
|
|
2223
2244
|
usesJsonResponseTool: jsonResponseTool != null
|
|
2224
2245
|
};
|