Home / Function/ test__stream_with_reasoning() — langchain Function Reference

test__stream_with_reasoning() — langchain Function Reference

Architecture documentation for the test__stream_with_reasoning() function in test_llms.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  b639f932_9d54_b2dc_9257_b71f5e3c82e8["test__stream_with_reasoning()"]
  b375279a_4970_f212_b93f_b3ffc97dc9d8["test_llms.py"]
  b639f932_9d54_b2dc_9257_b71f5e3c82e8 -->|defined in| b375279a_4970_f212_b93f_b3ffc97dc9d8
  style b639f932_9d54_b2dc_9257_b71f5e3c82e8 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/partners/ollama/tests/integration_tests/test_llms.py lines 128–152

def test__stream_with_reasoning(model: str) -> None:
    """Test low-level chunk streaming with `reasoning=True`."""
    llm = OllamaLLM(model=model, num_ctx=2**12, reasoning=True)

    result_chunk = None
    for chunk in llm._stream(SAMPLE):
        assert isinstance(chunk, GenerationChunk)
        if result_chunk is None:
            result_chunk = chunk
        else:
            result_chunk += chunk

    assert isinstance(result_chunk, GenerationChunk)
    assert result_chunk.text

    # Should have extracted reasoning into generation_info
    assert result_chunk.generation_info
    reasoning_content = result_chunk.generation_info.get("reasoning_content")
    assert reasoning_content
    assert len(reasoning_content) > 0
    # And neither the visible nor the hidden portion contains <think> tags
    assert "<think>" not in result_chunk.text
    assert "</think>" not in result_chunk.text
    assert "<think>" not in reasoning_content
    assert "</think>" not in reasoning_content

Domain

Subdomains

Frequently Asked Questions

What does test__stream_with_reasoning() do?
test__stream_with_reasoning() is a function in the langchain codebase, defined in libs/partners/ollama/tests/integration_tests/test_llms.py.
Where is test__stream_with_reasoning() defined?
test__stream_with_reasoning() is defined in libs/partners/ollama/tests/integration_tests/test_llms.py at line 128.

Analyze Your Own Codebase

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

Try Supermodel Free