test_astream_response_format() — langchain Function Reference
Architecture documentation for the test_astream_response_format() function in test_base.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD dc8f35dd_de27_93e2_71d1_dd80e0ddc1b5["test_astream_response_format()"] bd382a4e_442c_13ae_530c_6e34bc43623d["test_base.py"] dc8f35dd_de27_93e2_71d1_dd80e0ddc1b5 -->|defined in| bd382a4e_442c_13ae_530c_6e34bc43623d style dc8f35dd_de27_93e2_71d1_dd80e0ddc1b5 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/partners/openai/tests/integration_tests/chat_models/test_base.py lines 1042–1056
async def test_astream_response_format() -> None:
full: BaseMessageChunk | None = None
chunks = []
async for chunk in ChatOpenAI(model="gpt-5-nano").astream(
"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
Source
Frequently Asked Questions
What does test_astream_response_format() do?
test_astream_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_astream_response_format() defined?
test_astream_response_format() is defined in libs/partners/openai/tests/integration_tests/chat_models/test_base.py at line 1042.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free