@langchain/anthropic 0.3.17 → 0.3.19

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.
@@ -522,11 +522,11 @@ export declare class ChatAnthropicMessages<CallOptions extends ChatAnthropicCall
522
522
  _identifyingParams(): {
523
523
  system?: string | Anthropic.Messages.TextBlockParam[] | undefined;
524
524
  thinking?: Anthropic.Messages.ThinkingConfigParam | undefined;
525
+ metadata?: Anthropic.Messages.Metadata | undefined;
525
526
  model: Anthropic.Messages.Model;
526
527
  max_tokens: number;
527
528
  tools?: Anthropic.Messages.ToolUnion[] | undefined;
528
529
  tool_choice?: Anthropic.Messages.ToolChoice | undefined;
529
- metadata?: Anthropic.Messages.Metadata | undefined;
530
530
  temperature?: number | undefined;
531
531
  stream?: boolean | undefined;
532
532
  stop_sequences?: string[] | undefined;
@@ -540,11 +540,11 @@ export declare class ChatAnthropicMessages<CallOptions extends ChatAnthropicCall
540
540
  identifyingParams(): {
541
541
  system?: string | Anthropic.Messages.TextBlockParam[] | undefined;
542
542
  thinking?: Anthropic.Messages.ThinkingConfigParam | undefined;
543
+ metadata?: Anthropic.Messages.Metadata | undefined;
543
544
  model: Anthropic.Messages.Model;
544
545
  max_tokens: number;
545
546
  tools?: Anthropic.Messages.ToolUnion[] | undefined;
546
547
  tool_choice?: Anthropic.Messages.ToolChoice | undefined;
547
- metadata?: Anthropic.Messages.Metadata | undefined;
548
548
  temperature?: number | undefined;
549
549
  stream?: boolean | undefined;
550
550
  stop_sequences?: string[] | undefined;
@@ -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
- try {
155
- contentPartCopy.input = JSON.parse(contentPartCopy.input);
156
- }
157
- catch {
158
- contentPartCopy.input = {};
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
- try {
151
- contentPartCopy.input = JSON.parse(contentPartCopy.input);
152
- }
153
- catch {
154
- contentPartCopy.input = {};
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.17",
3
+ "version": "0.3.19",
4
4
  "description": "Anthropic integrations for LangChain.js",
5
5
  "type": "module",
6
6
  "engines": {
@@ -41,7 +41,7 @@
41
41
  "zod-to-json-schema": "^3.22.4"
42
42
  },
43
43
  "peerDependencies": {
44
- "@langchain/core": ">=0.2.21 <0.4.0"
44
+ "@langchain/core": ">=0.3.48 <0.4.0"
45
45
  },
46
46
  "devDependencies": {
47
47
  "@anthropic-ai/vertex-sdk": "^0.4.1",
@@ -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": "^17.6.0",
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"