test_image_generation_streaming_v1() — langchain Function Reference
Architecture documentation for the test_image_generation_streaming_v1() function in test_responses_api.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD 5a077681_4549_23ee_4b97_94cc278a6017["test_image_generation_streaming_v1()"] 992496d5_b7d4_139f_00cf_3e585d851f81["test_responses_api.py"] 5a077681_4549_23ee_4b97_94cc278a6017 -->|defined in| 992496d5_b7d4_139f_00cf_3e585d851f81 style 5a077681_4549_23ee_4b97_94cc278a6017 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/partners/openai/tests/integration_tests/chat_models/test_responses_api.py lines 855–888
def test_image_generation_streaming_v1() -> None:
"""Test image generation streaming."""
llm = ChatOpenAI(model="gpt-4.1", use_responses_api=True, output_version="v1")
tool = {
"type": "image_generation",
"quality": "low",
"output_format": "jpeg",
"output_compression": 100,
"size": "1024x1024",
}
standard_keys = {"type", "base64", "mime_type", "id", "index"}
extra_keys = {
"background",
"output_format",
"quality",
"revised_prompt",
"size",
"status",
}
full: BaseMessageChunk | None = None
for chunk in llm.stream("Draw a random short word in green font.", tools=[tool]):
assert isinstance(chunk, AIMessageChunk)
full = chunk if full is None else full + chunk
complete_ai_message = cast(AIMessageChunk, full)
tool_output = next(
block
for block in complete_ai_message.content
if isinstance(block, dict) and block["type"] == "image"
)
assert set(standard_keys).issubset(tool_output.keys())
assert set(extra_keys).issubset(tool_output["extras"].keys())
Domain
Subdomains
Source
Frequently Asked Questions
What does test_image_generation_streaming_v1() do?
test_image_generation_streaming_v1() is a function in the langchain codebase, defined in libs/partners/openai/tests/integration_tests/chat_models/test_responses_api.py.
Where is test_image_generation_streaming_v1() defined?
test_image_generation_streaming_v1() is defined in libs/partners/openai/tests/integration_tests/chat_models/test_responses_api.py at line 855.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free