test_json_mode_async() — langchain Function Reference
Architecture documentation for the test_json_mode_async() function in test_azure.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD bb537ef8_e730_6897_baac_2c1ae7358f8b["test_json_mode_async()"] c413d48d_e43d_eae6_47cb_3eea9394c77c["test_azure.py"] bb537ef8_e730_6897_baac_2c1ae7358f8b -->|defined in| c413d48d_e43d_eae6_47cb_3eea9394c77c style bb537ef8_e730_6897_baac_2c1ae7358f8b fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/partners/openai/tests/integration_tests/chat_models/test_azure.py lines 252–267
async def test_json_mode_async(llm: AzureChatOpenAI) -> None:
response = await llm.ainvoke(
"Return this as json: {'a': 1}", response_format={"type": "json_object"}
)
assert isinstance(response.content, str)
assert json.loads(response.content) == {"a": 1}
# Test streaming
full: BaseMessageChunk | None = None
async for chunk in llm.astream(
"Return this as json: {'a': 1}", response_format={"type": "json_object"}
):
full = chunk if full is None else full + chunk
assert isinstance(full, AIMessageChunk)
assert isinstance(full.content, str)
assert json.loads(full.content) == {"a": 1}
Domain
Subdomains
Source
Frequently Asked Questions
What does test_json_mode_async() do?
test_json_mode_async() is a function in the langchain codebase, defined in libs/partners/openai/tests/integration_tests/chat_models/test_azure.py.
Where is test_json_mode_async() defined?
test_json_mode_async() is defined in libs/partners/openai/tests/integration_tests/chat_models/test_azure.py at line 252.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free