_validate_tool_call_message() — langchain Function Reference
Architecture documentation for the _validate_tool_call_message() function in chat_models.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD 873906e7_1aac_f857_fbc7_973f8d33d1de["_validate_tool_call_message()"] c97ed773_97f8_2190_c0e8_546293fe345b["chat_models.py"] 873906e7_1aac_f857_fbc7_973f8d33d1de -->|defined in| c97ed773_97f8_2190_c0e8_546293fe345b d8558ca0_4956_161f_b284_039f6f9cdfd3["test_tool_calling()"] d8558ca0_4956_161f_b284_039f6f9cdfd3 -->|calls| 873906e7_1aac_f857_fbc7_973f8d33d1de ea8f4255_67c7_7352_2219_71761cc9609d["test_tool_calling_async()"] ea8f4255_67c7_7352_2219_71761cc9609d -->|calls| 873906e7_1aac_f857_fbc7_973f8d33d1de style 873906e7_1aac_f857_fbc7_973f8d33d1de fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/standard-tests/langchain_tests/integration_tests/chat_models.py lines 112–129
def _validate_tool_call_message(message: BaseMessage) -> None:
assert isinstance(message, AIMessage)
assert len(message.tool_calls) == 1
tool_call = message.tool_calls[0]
assert tool_call["name"] == "magic_function"
assert tool_call["args"] == {"input": 3}
assert tool_call["id"] is not None
assert tool_call.get("type") == "tool_call"
content_tool_calls = [
block for block in message.content_blocks if block["type"] == "tool_call"
]
assert len(content_tool_calls) == 1
content_tool_call = content_tool_calls[0]
assert content_tool_call["name"] == "magic_function"
assert content_tool_call["args"] == {"input": 3}
assert content_tool_call["id"] is not None
Domain
Subdomains
Source
Frequently Asked Questions
What does _validate_tool_call_message() do?
_validate_tool_call_message() is a function in the langchain codebase, defined in libs/standard-tests/langchain_tests/integration_tests/chat_models.py.
Where is _validate_tool_call_message() defined?
_validate_tool_call_message() is defined in libs/standard-tests/langchain_tests/integration_tests/chat_models.py at line 112.
What calls _validate_tool_call_message()?
_validate_tool_call_message() is called by 2 function(s): test_tool_calling, test_tool_calling_async.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free