Home / Function/ test_reasoning_invoke() — langchain Function Reference

test_reasoning_invoke() — langchain Function Reference

Architecture documentation for the test_reasoning_invoke() function in test_chat_models_reasoning.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  8ab6bb08_5de0_0a01_1f5d_a9ffdbbc8394["test_reasoning_invoke()"]
  5a5c2d7b_4823_4697_a3e1_c5e1c3fce238["test_chat_models_reasoning.py"]
  8ab6bb08_5de0_0a01_1f5d_a9ffdbbc8394 -->|defined in| 5a5c2d7b_4823_4697_a3e1_c5e1c3fce238
  style 8ab6bb08_5de0_0a01_1f5d_a9ffdbbc8394 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/partners/ollama/tests/integration_tests/chat_models/test_chat_models_reasoning.py lines 155–177

async def test_reasoning_invoke(model: str, use_async: bool) -> None:
    """Test invoke with `reasoning=True`."""
    llm = ChatOllama(model=model, num_ctx=2**12, reasoning=True)
    message = HumanMessage(content=SAMPLE)
    if use_async:
        result = await llm.ainvoke([message])
    else:
        result = llm.invoke([message])
    assert result.content
    assert "reasoning_content" in result.additional_kwargs
    assert len(result.additional_kwargs["reasoning_content"]) > 0
    assert "<think>" not in result.content
    assert "</think>" not in result.content
    assert "<think>" not in result.additional_kwargs["reasoning_content"]
    assert "</think>" not in result.additional_kwargs["reasoning_content"]

    content_blocks = result.content_blocks
    assert content_blocks is not None
    assert len(content_blocks) > 0
    reasoning_blocks = [
        block for block in content_blocks if block.get("type") == "reasoning"
    ]
    assert len(reasoning_blocks) > 0

Domain

Subdomains

Frequently Asked Questions

What does test_reasoning_invoke() do?
test_reasoning_invoke() is a function in the langchain codebase, defined in libs/partners/ollama/tests/integration_tests/chat_models/test_chat_models_reasoning.py.
Where is test_reasoning_invoke() defined?
test_reasoning_invoke() is defined in libs/partners/ollama/tests/integration_tests/chat_models/test_chat_models_reasoning.py at line 155.

Analyze Your Own Codebase

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

Try Supermodel Free