Home / Function/ test_strict_tool_use() — langchain Function Reference

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
  bbc49355_972d_0def_0986_1e27919f381d["test_strict_tool_use()"]
  18428dc5_a41b_90c6_88ad_615296ee3311["test_chat_models.py"]
  bbc49355_972d_0def_0986_1e27919f381d -->|defined in| 18428dc5_a41b_90c6_88ad_615296ee3311
  style bbc49355_972d_0def_0986_1e27919f381d fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/partners/anthropic/tests/unit_tests/test_chat_models.py lines 1664–1676

def test_strict_tool_use() -> None:
    model = ChatAnthropic(
        model=MODEL_NAME,  # 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)

    tool_definition = model_with_tools.kwargs["tools"][0]  # type: ignore[attr-defined]
    assert tool_definition["strict"] is True

Domain

Subdomains

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/unit_tests/test_chat_models.py.
Where is test_strict_tool_use() defined?
test_strict_tool_use() is defined in libs/partners/anthropic/tests/unit_tests/test_chat_models.py at line 1664.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free