test_anthropic_bind_tools_tool_choice() — langchain Function Reference
Architecture documentation for the test_anthropic_bind_tools_tool_choice() function in test_chat_models.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD d84a71c6_6950_786c_a6bd_b160a1ea7d6f["test_anthropic_bind_tools_tool_choice()"] 18428dc5_a41b_90c6_88ad_615296ee3311["test_chat_models.py"] d84a71c6_6950_786c_a6bd_b160a1ea7d6f -->|defined in| 18428dc5_a41b_90c6_88ad_615296ee3311 style d84a71c6_6950_786c_a6bd_b160a1ea7d6f fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/partners/anthropic/tests/unit_tests/test_chat_models.py lines 1273–1301
def test_anthropic_bind_tools_tool_choice() -> None:
chat_model = ChatAnthropic( # type: ignore[call-arg, call-arg]
model=MODEL_NAME,
anthropic_api_key="secret-api-key",
)
chat_model_with_tools = chat_model.bind_tools(
[GetWeather],
tool_choice={"type": "tool", "name": "GetWeather"},
)
assert cast("RunnableBinding", chat_model_with_tools).kwargs["tool_choice"] == {
"type": "tool",
"name": "GetWeather",
}
chat_model_with_tools = chat_model.bind_tools(
[GetWeather],
tool_choice="GetWeather",
)
assert cast("RunnableBinding", chat_model_with_tools).kwargs["tool_choice"] == {
"type": "tool",
"name": "GetWeather",
}
chat_model_with_tools = chat_model.bind_tools([GetWeather], tool_choice="auto")
assert cast("RunnableBinding", chat_model_with_tools).kwargs["tool_choice"] == {
"type": "auto",
}
chat_model_with_tools = chat_model.bind_tools([GetWeather], tool_choice="any")
assert cast("RunnableBinding", chat_model_with_tools).kwargs["tool_choice"] == {
"type": "any",
}
Domain
Subdomains
Source
Frequently Asked Questions
What does test_anthropic_bind_tools_tool_choice() do?
test_anthropic_bind_tools_tool_choice() is a function in the langchain codebase, defined in libs/partners/anthropic/tests/unit_tests/test_chat_models.py.
Where is test_anthropic_bind_tools_tool_choice() defined?
test_anthropic_bind_tools_tool_choice() is defined in libs/partners/anthropic/tests/unit_tests/test_chat_models.py at line 1273.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free