test_json_mode() — langchain Function Reference
Architecture documentation for the test_json_mode() function in test_azure.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD d477d4c7_49a7_a6a1_200d_ae568388d09a["test_json_mode()"] c413d48d_e43d_eae6_47cb_3eea9394c77c["test_azure.py"] d477d4c7_49a7_a6a1_200d_ae568388d09a -->|defined in| c413d48d_e43d_eae6_47cb_3eea9394c77c style d477d4c7_49a7_a6a1_200d_ae568388d09a fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/partners/openai/tests/integration_tests/chat_models/test_azure.py lines 234–249
def test_json_mode(llm: AzureChatOpenAI) -> None:
response = llm.invoke(
"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
for chunk in llm.stream(
"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() do?
test_json_mode() 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() defined?
test_json_mode() is defined in libs/partners/openai/tests/integration_tests/chat_models/test_azure.py at line 234.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free