@langchain/anthropic 0.3.16 → 0.3.18
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/chat_models.cjs
CHANGED
|
@@ -642,7 +642,9 @@ class ChatAnthropicMessages extends chat_models_1.BaseChatModel {
|
|
|
642
642
|
return {
|
|
643
643
|
name: tool.name,
|
|
644
644
|
description: tool.description,
|
|
645
|
-
input_schema: (0,
|
|
645
|
+
input_schema: ((0, types_1.isZodSchema)(tool.schema)
|
|
646
|
+
? (0, zod_to_json_schema_1.zodToJsonSchema)(tool.schema)
|
|
647
|
+
: tool.schema),
|
|
646
648
|
};
|
|
647
649
|
}
|
|
648
650
|
throw new Error(`Unknown tool type passed to ChatAnthropic: ${JSON.stringify(tool, null, 2)}`);
|
package/dist/chat_models.js
CHANGED
|
@@ -639,7 +639,9 @@ export class ChatAnthropicMessages extends BaseChatModel {
|
|
|
639
639
|
return {
|
|
640
640
|
name: tool.name,
|
|
641
641
|
description: tool.description,
|
|
642
|
-
input_schema:
|
|
642
|
+
input_schema: (isZodSchema(tool.schema)
|
|
643
|
+
? zodToJsonSchema(tool.schema)
|
|
644
|
+
: tool.schema),
|
|
643
645
|
};
|
|
644
646
|
}
|
|
645
647
|
throw new Error(`Unknown tool type passed to ChatAnthropic: ${JSON.stringify(tool, null, 2)}`);
|
|
@@ -151,11 +151,13 @@ function _formatContent(content) {
|
|
|
151
151
|
}
|
|
152
152
|
if ("input" in contentPartCopy) {
|
|
153
153
|
// Anthropic tool use inputs should be valid objects, when applicable.
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
154
|
+
if (typeof contentPartCopy.input === "string") {
|
|
155
|
+
try {
|
|
156
|
+
contentPartCopy.input = JSON.parse(contentPartCopy.input);
|
|
157
|
+
}
|
|
158
|
+
catch {
|
|
159
|
+
contentPartCopy.input = {};
|
|
160
|
+
}
|
|
159
161
|
}
|
|
160
162
|
}
|
|
161
163
|
// TODO: Fix when SDK types are fixed
|
|
@@ -147,11 +147,13 @@ function _formatContent(content) {
|
|
|
147
147
|
}
|
|
148
148
|
if ("input" in contentPartCopy) {
|
|
149
149
|
// Anthropic tool use inputs should be valid objects, when applicable.
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
150
|
+
if (typeof contentPartCopy.input === "string") {
|
|
151
|
+
try {
|
|
152
|
+
contentPartCopy.input = JSON.parse(contentPartCopy.input);
|
|
153
|
+
}
|
|
154
|
+
catch {
|
|
155
|
+
contentPartCopy.input = {};
|
|
156
|
+
}
|
|
155
157
|
}
|
|
156
158
|
}
|
|
157
159
|
// TODO: Fix when SDK types are fixed
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@langchain/anthropic",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.18",
|
|
4
4
|
"description": "Anthropic integrations for LangChain.js",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
"jest": "^29.5.0",
|
|
63
63
|
"jest-environment-node": "^29.6.4",
|
|
64
64
|
"prettier": "^2.8.3",
|
|
65
|
-
"release-it": "^
|
|
65
|
+
"release-it": "^18.1.2",
|
|
66
66
|
"rimraf": "^5.0.1",
|
|
67
67
|
"ts-jest": "^29.1.0",
|
|
68
68
|
"typescript": "~5.1.6"
|