TestToolStrategy Class — langchain Architecture
Architecture documentation for the TestToolStrategy class in test_responses.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD ebb21ee0_43ab_2154_cc04_59917941f636["TestToolStrategy"] 4ec8d71c_3a26_be00_a621_f5533ddc4441["test_responses.py"] ebb21ee0_43ab_2154_cc04_59917941f636 -->|defined in| 4ec8d71c_3a26_be00_a621_f5533ddc4441 f1399eba_785e_381f_21e4_944d9f2cd7c7["test_basic_creation()"] ebb21ee0_43ab_2154_cc04_59917941f636 -->|method| f1399eba_785e_381f_21e4_944d9f2cd7c7 e624cd2b_c0e6_aaf9_f73a_6c0d0c5c5bfb["test_multiple_schemas()"] ebb21ee0_43ab_2154_cc04_59917941f636 -->|method| e624cd2b_c0e6_aaf9_f73a_6c0d0c5c5bfb 607e6943_654b_56e9_40a4_1812d23df33a["test_schema_with_tool_message_content()"] ebb21ee0_43ab_2154_cc04_59917941f636 -->|method| 607e6943_654b_56e9_40a4_1812d23df33a
Relationship Graph
Source Code
libs/langchain_v1/tests/unit_tests/agents/test_responses.py lines 36–60
class TestToolStrategy:
"""Test ToolStrategy dataclass."""
def test_basic_creation(self) -> None:
"""Test basic ToolStrategy creation."""
strategy = ToolStrategy(schema=_TestModel)
assert strategy.schema == _TestModel
assert strategy.tool_message_content is None
assert len(strategy.schema_specs) == 1
assert strategy.schema_specs[0].schema == _TestModel
def test_multiple_schemas(self) -> None:
"""Test ToolStrategy with multiple schemas."""
strategy = ToolStrategy(schema=_TestModel | CustomModel)
assert len(strategy.schema_specs) == 2
assert strategy.schema_specs[0].schema == _TestModel
assert strategy.schema_specs[1].schema == CustomModel
def test_schema_with_tool_message_content(self) -> None:
"""Test ToolStrategy with tool message content."""
strategy = ToolStrategy(schema=_TestModel, tool_message_content="custom message")
assert strategy.schema == _TestModel
assert strategy.tool_message_content == "custom message"
assert len(strategy.schema_specs) == 1
assert strategy.schema_specs[0].schema == _TestModel
Source
Frequently Asked Questions
What is the TestToolStrategy class?
TestToolStrategy is a class in the langchain codebase, defined in libs/langchain_v1/tests/unit_tests/agents/test_responses.py.
Where is TestToolStrategy defined?
TestToolStrategy is defined in libs/langchain_v1/tests/unit_tests/agents/test_responses.py at line 36.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free