test_reasoning_stream() — langchain Function Reference
Architecture documentation for the test_reasoning_stream() function in test_chat_models_reasoning.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD e5edbc0c_d53f_853e_4779_369dbe63de12["test_reasoning_stream()"] 5a5c2d7b_4823_4697_a3e1_c5e1c3fce238["test_chat_models_reasoning.py"] e5edbc0c_d53f_853e_4779_369dbe63de12 -->|defined in| 5a5c2d7b_4823_4697_a3e1_c5e1c3fce238 style e5edbc0c_d53f_853e_4779_369dbe63de12 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/partners/ollama/tests/integration_tests/chat_models/test_chat_models_reasoning.py lines 80–119
async def test_reasoning_stream(model: str, use_async: bool) -> None:
"""Test streaming with `reasoning=True`."""
llm = ChatOllama(model=model, num_ctx=2**12, reasoning=True)
messages = [
{
"role": "user",
"content": SAMPLE,
}
]
result = None
if use_async:
async for chunk in llm.astream(messages):
assert isinstance(chunk, BaseMessageChunk)
if result is None:
result = chunk
continue
result += chunk
else:
for chunk in llm.stream(messages):
assert isinstance(chunk, BaseMessageChunk)
if result is None:
result = chunk
continue
result += chunk
assert isinstance(result, AIMessageChunk)
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
Source
Frequently Asked Questions
What does test_reasoning_stream() do?
test_reasoning_stream() 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_stream() defined?
test_reasoning_stream() is defined in libs/partners/ollama/tests/integration_tests/chat_models/test_chat_models_reasoning.py at line 80.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free