test_reasoning_aggregation() — langchain Function Reference
Architecture documentation for the test_reasoning_aggregation() function in test_llms.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD 8cb149d9_e5ca_328b_8c35_264f19425c18["test_reasoning_aggregation()"] 92c74082_b175_00d9_ee08_72212a280d77["test_llms.py"] 8cb149d9_e5ca_328b_8c35_264f19425c18 -->|defined in| 92c74082_b175_00d9_ee08_72212a280d77 style 8cb149d9_e5ca_328b_8c35_264f19425c18 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/partners/ollama/tests/unit_tests/test_llms.py lines 49–67
def test_reasoning_aggregation() -> None:
"""Test that reasoning chunks are aggregated into final response."""
llm = OllamaLLM(model=MODEL_NAME, reasoning=True)
prompts = ["some prompt"]
mock_stream = [
{"thinking": "I am thinking.", "done": False},
{"thinking": " Still thinking.", "done": False},
{"response": "Final Answer.", "done": True},
]
with patch.object(llm, "_create_generate_stream") as mock_stream_method:
mock_stream_method.return_value = iter(mock_stream)
result = llm.generate(prompts)
assert result.generations[0][0].generation_info is not None
assert (
result.generations[0][0].generation_info["thinking"]
== "I am thinking. Still thinking."
)
Domain
Subdomains
Source
Frequently Asked Questions
What does test_reasoning_aggregation() do?
test_reasoning_aggregation() is a function in the langchain codebase, defined in libs/partners/ollama/tests/unit_tests/test_llms.py.
Where is test_reasoning_aggregation() defined?
test_reasoning_aggregation() is defined in libs/partners/ollama/tests/unit_tests/test_llms.py at line 49.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free