@langchain/anthropic 0.3.23 → 0.3.24

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/index.d.ts CHANGED
@@ -1,2 +1,3 @@
1
1
  export * from "./chat_models.js";
2
2
  export { convertPromptToAnthropic } from "./utils/prompts.js";
3
+ export { type ChatAnthropicContentBlock } from "./types.js";
package/dist/types.d.ts CHANGED
@@ -28,6 +28,7 @@ export type AnthropicRedactedThinkingBlockParam = Anthropic.Messages.RedactedThi
28
28
  export type AnthropicServerToolUseBlockParam = Anthropic.Messages.ServerToolUseBlockParam;
29
29
  export type AnthropicWebSearchToolResultBlockParam = Anthropic.Messages.WebSearchToolResultBlockParam;
30
30
  export type AnthropicWebSearchResultBlockParam = Anthropic.Messages.WebSearchResultBlockParam;
31
- export type AnthropicContentBlock = AnthropicTextBlockParam | AnthropicImageBlockParam | AnthropicToolUseBlockParam | AnthropicToolResultBlockParam | AnthropicDocumentBlockParam | AnthropicThinkingBlockParam | AnthropicRedactedThinkingBlockParam | AnthropicServerToolUseBlockParam | AnthropicWebSearchToolResultBlockParam | AnthropicWebSearchResultBlockParam;
31
+ export type AnthropicSearchResultBlockParam = Anthropic.Beta.BetaSearchResultBlockParam;
32
+ export type ChatAnthropicContentBlock = AnthropicTextBlockParam | AnthropicImageBlockParam | AnthropicToolUseBlockParam | AnthropicToolResultBlockParam | AnthropicDocumentBlockParam | AnthropicThinkingBlockParam | AnthropicRedactedThinkingBlockParam | AnthropicServerToolUseBlockParam | AnthropicWebSearchToolResultBlockParam | AnthropicWebSearchResultBlockParam | AnthropicSearchResultBlockParam;
32
33
  export declare function isAnthropicImageBlockParam(block: unknown): block is AnthropicImageBlockParam;
33
34
  export type AnthropicBuiltInToolUnion = Exclude<Anthropic.Messages.ToolUnion, Anthropic.Messages.Tool>;
@@ -344,6 +344,21 @@ function _formatContent(content) {
344
344
  };
345
345
  return block;
346
346
  }
347
+ else if (contentPart.type === "search_result") {
348
+ const block = {
349
+ type: "search_result", // Explicitly setting the type as "search_result"
350
+ title: contentPart.title,
351
+ source: contentPart.source,
352
+ ...("cache_control" in contentPart && contentPart.cache_control
353
+ ? { cache_control: contentPart.cache_control }
354
+ : {}),
355
+ ...("citations" in contentPart && contentPart.citations
356
+ ? { citations: contentPart.citations }
357
+ : {}),
358
+ content: contentPart.content,
359
+ };
360
+ return block;
361
+ }
347
362
  else if (textTypes.find((t) => t === contentPart.type) &&
348
363
  "text" in contentPart) {
349
364
  // Assuming contentPart is of type MessageContentText here
@@ -340,6 +340,21 @@ function _formatContent(content) {
340
340
  };
341
341
  return block;
342
342
  }
343
+ else if (contentPart.type === "search_result") {
344
+ const block = {
345
+ type: "search_result", // Explicitly setting the type as "search_result"
346
+ title: contentPart.title,
347
+ source: contentPart.source,
348
+ ...("cache_control" in contentPart && contentPart.cache_control
349
+ ? { cache_control: contentPart.cache_control }
350
+ : {}),
351
+ ...("citations" in contentPart && contentPart.citations
352
+ ? { citations: contentPart.citations }
353
+ : {}),
354
+ content: contentPart.content,
355
+ };
356
+ return block;
357
+ }
343
358
  else if (textTypes.find((t) => t === contentPart.type) &&
344
359
  "text" in contentPart) {
345
360
  // Assuming contentPart is of type MessageContentText here
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@langchain/anthropic",
3
- "version": "0.3.23",
3
+ "version": "0.3.24",
4
4
  "description": "Anthropic integrations for LangChain.js",
5
5
  "type": "module",
6
6
  "engines": {
@@ -35,14 +35,14 @@
35
35
  "author": "LangChain",
36
36
  "license": "MIT",
37
37
  "dependencies": {
38
- "@anthropic-ai/sdk": "^0.52.0",
38
+ "@anthropic-ai/sdk": "^0.56.0",
39
39
  "fast-xml-parser": "^4.4.1"
40
40
  },
41
41
  "peerDependencies": {
42
42
  "@langchain/core": ">=0.3.58 <0.4.0"
43
43
  },
44
44
  "devDependencies": {
45
- "@anthropic-ai/vertex-sdk": "^0.4.1",
45
+ "@anthropic-ai/vertex-sdk": "^0.11.5",
46
46
  "@jest/globals": "^29.5.0",
47
47
  "@langchain/core": "workspace:*",
48
48
  "@langchain/scripts": ">=0.1.0 <0.2.0",