Home / Function/ test_stream_response_format() — langchain Function Reference

test_stream_response_format() — langchain Function Reference

Architecture documentation for the test_stream_response_format() function in test_base.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  fb569dba_3711_11d8_965e_979fb78fd390["test_stream_response_format()"]
  bd382a4e_442c_13ae_530c_6e34bc43623d["test_base.py"]
  fb569dba_3711_11d8_965e_979fb78fd390 -->|defined in| bd382a4e_442c_13ae_530c_6e34bc43623d
  style fb569dba_3711_11d8_965e_979fb78fd390 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/partners/openai/tests/integration_tests/chat_models/test_base.py lines 1025–1039

def test_stream_response_format() -> None:
    full: BaseMessageChunk | None = None
    chunks = []
    for chunk in ChatOpenAI(model="gpt-5-nano").stream(
        "how are ya", response_format=Foo
    ):
        chunks.append(chunk)
        full = chunk if full is None else full + chunk
    assert len(chunks) > 1
    assert isinstance(full, AIMessageChunk)
    parsed = full.additional_kwargs["parsed"]
    assert isinstance(parsed, Foo)
    assert isinstance(full.content, str)
    parsed_content = json.loads(full.content)
    assert parsed.response == parsed_content["response"]

Domain

Subdomains

Frequently Asked Questions

What does test_stream_response_format() do?
test_stream_response_format() is a function in the langchain codebase, defined in libs/partners/openai/tests/integration_tests/chat_models/test_base.py.
Where is test_stream_response_format() defined?
test_stream_response_format() is defined in libs/partners/openai/tests/integration_tests/chat_models/test_base.py at line 1025.

Analyze Your Own Codebase

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

Try Supermodel Free