Home / Function/ test_reasoning_output_stream() — langchain Function Reference

test_reasoning_output_stream() — langchain Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  48404265_f7dd_6099_005e_224780401e2b["test_reasoning_output_stream()"]
  af57ae60_607e_c138_9ab0_fb8bb1c5916a["test_chat_models.py"]
  48404265_f7dd_6099_005e_224780401e2b -->|defined in| af57ae60_607e_c138_9ab0_fb8bb1c5916a
  style 48404265_f7dd_6099_005e_224780401e2b fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/partners/groq/tests/integration_tests/test_chat_models.py lines 246–273

def test_reasoning_output_stream() -> None:
    """Test reasoning output from ChatGroq with stream."""
    chat = ChatGroq(
        model=REASONING_MODEL_NAME,
        reasoning_format="parsed",
    )
    message = [
        SystemMessage(
            content="You are a helpful assistant that translates English to French."
        ),
        HumanMessage(content="I love programming."),
    ]

    full_response: AIMessageChunk | None = None
    for token in chat.stream(message):
        assert isinstance(token, AIMessageChunk)

        if full_response is None:
            full_response = token
        else:
            # Casting since adding results in a type error
            full_response = cast("AIMessageChunk", full_response + token)

    assert full_response is not None
    assert isinstance(full_response, AIMessageChunk)
    assert "reasoning_content" in full_response.additional_kwargs
    assert isinstance(full_response.additional_kwargs["reasoning_content"], str)
    assert len(full_response.additional_kwargs["reasoning_content"]) > 0

Domain

Subdomains

Frequently Asked Questions

What does test_reasoning_output_stream() do?
test_reasoning_output_stream() is a function in the langchain codebase, defined in libs/partners/groq/tests/integration_tests/test_chat_models.py.
Where is test_reasoning_output_stream() defined?
test_reasoning_output_stream() is defined in libs/partners/groq/tests/integration_tests/test_chat_models.py at line 246.

Analyze Your Own Codebase

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

Try Supermodel Free