test_strict_tool_use() — langchain Function Reference
Architecture documentation for the test_strict_tool_use() function in test_chat_models.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD a2d4ab01_8672_2055_e79d_fc3990ae7743["test_strict_tool_use()"] f27640dd_3870_5548_d153_f9504ae1021f["test_chat_models.py"] a2d4ab01_8672_2055_e79d_fc3990ae7743 -->|defined in| f27640dd_3870_5548_d153_f9504ae1021f style a2d4ab01_8672_2055_e79d_fc3990ae7743 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/partners/anthropic/tests/integration_tests/test_chat_models.py lines 778–790
def test_strict_tool_use() -> None:
model = ChatAnthropic(
model="claude-sonnet-4-5", # type: ignore[call-arg]
)
def get_weather(location: str, unit: Literal["C", "F"]) -> str:
"""Get the weather at a location."""
return "75 degrees Fahrenheit."
model_with_tools = model.bind_tools([get_weather], strict=True)
response = model_with_tools.invoke("What's the weather in Boston, in Celsius?")
assert response.tool_calls
Domain
Subdomains
Source
Frequently Asked Questions
What does test_strict_tool_use() do?
test_strict_tool_use() is a function in the langchain codebase, defined in libs/partners/anthropic/tests/integration_tests/test_chat_models.py.
Where is test_strict_tool_use() defined?
test_strict_tool_use() is defined in libs/partners/anthropic/tests/integration_tests/test_chat_models.py at line 778.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free