test_strict_tool_use_payload() — langchain Function Reference
Architecture documentation for the test_strict_tool_use_payload() function in test_chat_models.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD f2065126_2cc3_d8fc_0782_a00eb79b6c99["test_strict_tool_use_payload()"] 18428dc5_a41b_90c6_88ad_615296ee3311["test_chat_models.py"] f2065126_2cc3_d8fc_0782_a00eb79b6c99 -->|defined in| 18428dc5_a41b_90c6_88ad_615296ee3311 style f2065126_2cc3_d8fc_0782_a00eb79b6c99 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/partners/anthropic/tests/unit_tests/test_chat_models.py lines 1706–1728
def test_strict_tool_use_payload() -> None:
"""Test that strict tool use property is correctly passed through to payload."""
def get_weather(location: str) -> str:
"""Get the weather at a location."""
return "Sunny"
# Test that strict=True is correctly passed to payload
model = ChatAnthropic(model=MODEL_NAME) # type: ignore[call-arg]
model_with_tools = model.bind_tools([get_weather], strict=True)
payload = model_with_tools._get_request_payload( # type: ignore[attr-defined]
"What's the weather?",
**model_with_tools.kwargs, # type: ignore[attr-defined]
)
assert payload["tools"][0]["strict"] is True
# Test that strict=False is correctly passed to payload
model_without_strict = model.bind_tools([get_weather], strict=False)
payload = model_without_strict._get_request_payload( # type: ignore[attr-defined]
"What's the weather?",
**model_without_strict.kwargs, # type: ignore[attr-defined]
)
assert payload["tools"][0].get("strict") is False
Domain
Subdomains
Source
Frequently Asked Questions
What does test_strict_tool_use_payload() do?
test_strict_tool_use_payload() is a function in the langchain codebase, defined in libs/partners/anthropic/tests/unit_tests/test_chat_models.py.
Where is test_strict_tool_use_payload() defined?
test_strict_tool_use_payload() is defined in libs/partners/anthropic/tests/unit_tests/test_chat_models.py at line 1706.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free