test__convert_to_openai_response_format() — langchain Function Reference
Architecture documentation for the test__convert_to_openai_response_format() function in test_base.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD 7cb4426d_031b_79ab_ad16_afec1dd3e765["test__convert_to_openai_response_format()"] 48232d20_f8c1_b597_14fa_7dc407e9bfe5["test_base.py"] 7cb4426d_031b_79ab_ad16_afec1dd3e765 -->|defined in| 48232d20_f8c1_b597_14fa_7dc407e9bfe5 style 7cb4426d_031b_79ab_ad16_afec1dd3e765 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/partners/openai/tests/unit_tests/chat_models/test_base.py lines 1111–1151
def test__convert_to_openai_response_format() -> None:
# Test response formats that aren't tool-like.
response_format: dict = {
"type": "json_schema",
"json_schema": {
"name": "math_reasoning",
"schema": {
"type": "object",
"properties": {
"steps": {
"type": "array",
"items": {
"type": "object",
"properties": {
"explanation": {"type": "string"},
"output": {"type": "string"},
},
"required": ["explanation", "output"],
"additionalProperties": False,
},
},
"final_answer": {"type": "string"},
},
"required": ["steps", "final_answer"],
"additionalProperties": False,
},
"strict": True,
},
}
actual = _convert_to_openai_response_format(response_format)
assert actual == response_format
actual = _convert_to_openai_response_format(response_format["json_schema"])
assert actual == response_format
actual = _convert_to_openai_response_format(response_format, strict=True)
assert actual == response_format
with pytest.raises(ValueError):
_convert_to_openai_response_format(response_format, strict=False)
Domain
Subdomains
Source
Frequently Asked Questions
What does test__convert_to_openai_response_format() do?
test__convert_to_openai_response_format() is a function in the langchain codebase, defined in libs/partners/openai/tests/unit_tests/chat_models/test_base.py.
Where is test__convert_to_openai_response_format() defined?
test__convert_to_openai_response_format() is defined in libs/partners/openai/tests/unit_tests/chat_models/test_base.py at line 1111.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free