From 46cef90f7bf453a048d0354b2de3946b23c686b4 Mon Sep 17 00:00:00 2001 From: ccurme Date: Mon, 30 Jun 2025 11:19:34 -0400 Subject: [PATCH] core: expose tool message recognized block types (#31787) --- libs/core/langchain_core/tools/base.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libs/core/langchain_core/tools/base.py b/libs/core/langchain_core/tools/base.py index 3caf190ef81..55ad21a003c 100644 --- a/libs/core/langchain_core/tools/base.py +++ b/libs/core/langchain_core/tools/base.py @@ -74,6 +74,7 @@ if TYPE_CHECKING: from collections.abc import Sequence FILTERED_ARGS = ("run_manager", "callbacks") +TOOL_MESSAGE_BLOCK_TYPES = ("text", "image_url", "image", "json") class SchemaAnnotationError(TypeError): @@ -1189,7 +1190,7 @@ def _is_message_content_block(obj: Any) -> bool: if isinstance(obj, str): return True if isinstance(obj, dict): - return obj.get("type", None) in ("text", "image_url", "image", "json") + return obj.get("type", None) in TOOL_MESSAGE_BLOCK_TYPES return False