test_structured_output_verbosity() — langchain Function Reference
Architecture documentation for the test_structured_output_verbosity() function in test_base.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD a7155408_593c_6878_2c77_2e80b817f44c["test_structured_output_verbosity()"] 48232d20_f8c1_b597_14fa_7dc407e9bfe5["test_base.py"] a7155408_593c_6878_2c77_2e80b817f44c -->|defined in| 48232d20_f8c1_b597_14fa_7dc407e9bfe5 style a7155408_593c_6878_2c77_2e80b817f44c fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/partners/openai/tests/unit_tests/chat_models/test_base.py lines 3043–3083
def test_structured_output_verbosity(
verbosity_format: str, streaming: bool, schema_format: str
) -> None:
class MySchema(BaseModel):
foo: str
if verbosity_format == "model_kwargs":
init_params: dict[str, Any] = {"model_kwargs": {"text": {"verbosity": "high"}}}
else:
init_params = {"verbosity": "high"}
if streaming:
init_params["streaming"] = True
llm = ChatOpenAI(model="gpt-5", use_responses_api=True, **init_params)
if schema_format == "pydantic":
schema: Any = MySchema
else:
schema = MySchema.model_json_schema()
structured_llm = llm.with_structured_output(schema)
sequence = cast(RunnableSequence, structured_llm)
binding = cast(RunnableBinding, sequence.first)
bound_llm = cast(ChatOpenAI, binding.bound)
bound_kwargs = binding.kwargs
messages = [HumanMessage(content="Hello")]
payload = bound_llm._get_request_payload(messages, **bound_kwargs)
# Verify that verbosity is present in `text` param
assert "text" in payload
assert "verbosity" in payload["text"]
assert payload["text"]["verbosity"] == "high"
# Verify that schema is passed correctly
if schema_format == "pydantic" and not streaming:
assert payload["text_format"] == schema
else:
assert "format" in payload["text"]
assert payload["text"]["format"]["type"] == "json_schema"
Domain
Subdomains
Source
Frequently Asked Questions
What does test_structured_output_verbosity() do?
test_structured_output_verbosity() is a function in the langchain codebase, defined in libs/partners/openai/tests/unit_tests/chat_models/test_base.py.
Where is test_structured_output_verbosity() defined?
test_structured_output_verbosity() is defined in libs/partners/openai/tests/unit_tests/chat_models/test_base.py at line 3043.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free