Home / Function/ test_reasoning_param_passed_to_client() — langchain Function Reference

test_reasoning_param_passed_to_client() — langchain Function Reference

Architecture documentation for the test_reasoning_param_passed_to_client() function in test_chat_models.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  51897dbe_07ea_62ca_7733_2803354fa056["test_reasoning_param_passed_to_client()"]
  9c4a2438_9884_cbb0_3cf5_de8827531653["test_chat_models.py"]
  51897dbe_07ea_62ca_7733_2803354fa056 -->|defined in| 9c4a2438_9884_cbb0_3cf5_de8827531653
  style 51897dbe_07ea_62ca_7733_2803354fa056 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/partners/ollama/tests/unit_tests/test_chat_models.py lines 415–449

def test_reasoning_param_passed_to_client() -> None:
    """Test that the reasoning parameter is correctly passed to the Ollama client."""
    with patch("langchain_ollama.chat_models.Client") as mock_client_class:
        mock_client = MagicMock()
        mock_client_class.return_value = mock_client
        mock_client.chat.return_value = [
            {
                "model": "deepseek-r1",
                "created_at": "2025-01-01T00:00:00.000000000Z",
                "message": {"role": "assistant", "content": "I am thinking..."},
                "done": True,
                "done_reason": "stop",
            }
        ]

        # Case 1: reasoning=True in init
        llm = ChatOllama(model="deepseek-r1", reasoning=True)
        llm.invoke([HumanMessage("Hello")])

        call_kwargs = mock_client.chat.call_args[1]
        assert call_kwargs["think"] is True

        # Case 2: reasoning=False in init
        llm = ChatOllama(model="deepseek-r1", reasoning=False)
        llm.invoke([HumanMessage("Hello")])

        call_kwargs = mock_client.chat.call_args[1]
        assert call_kwargs["think"] is False

        # Case 3: reasoning passed in invoke
        llm = ChatOllama(model="deepseek-r1")
        llm.invoke([HumanMessage("Hello")], reasoning=True)

        call_kwargs = mock_client.chat.call_args[1]
        assert call_kwargs["think"] is True

Domain

Subdomains

Frequently Asked Questions

What does test_reasoning_param_passed_to_client() do?
test_reasoning_param_passed_to_client() is a function in the langchain codebase, defined in libs/partners/ollama/tests/unit_tests/test_chat_models.py.
Where is test_reasoning_param_passed_to_client() defined?
test_reasoning_param_passed_to_client() is defined in libs/partners/ollama/tests/unit_tests/test_chat_models.py at line 415.

Analyze Your Own Codebase

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

Try Supermodel Free