core: expose tool message recognized block types (#31787)

This commit is contained in:
ccurme 2025-06-30 11:19:34 -04:00 committed by GitHub
parent 428c276948
commit 46cef90f7b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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