mirror of
https://github.com/tiennm99/litellm.git
synced 2026-08-11 14:22:48 +00:00
feat(openai): Add verbosity parameter support for GPT-5 family models (#16660)
OpenAI's GPT-5 model family supports a verbosity parameter to control the length and detail of responses. This parameter accepts three values: 'low', 'medium', or 'high'. Changes: - Added verbosity parameter to completion() and acompletion() signatures - Added verbosity to DEFAULT_CHAT_COMPLETION_PARAM_VALUES in constants.py - Added verbosity to get_optional_params() in utils.py - Added verbosity to GPT-5 supported params list - Updated OpenAI docs with verbosity usage examples - Added comprehensive test for verbosity parameter Supported models: gpt-5, gpt-5.1, gpt-5-mini, gpt-5-nano, gpt-5-codex, gpt-5-pro
This commit is contained in:
@@ -155,6 +155,32 @@ def test_gpt5_codex_supports_function_calling(config: OpenAIConfig):
|
||||
assert "tools" in supported_params
|
||||
|
||||
|
||||
def test_gpt5_verbosity_parameter(config: OpenAIConfig):
|
||||
"""Test that verbosity parameter passes through correctly for GPT-5 models.
|
||||
|
||||
The verbosity parameter controls output length and detail for GPT-5 family models.
|
||||
Supported values: 'low', 'medium', 'high'
|
||||
Supported models: gpt-5, gpt-5.1, gpt-5-mini, gpt-5-nano, gpt-5-codex, gpt-5-pro
|
||||
"""
|
||||
# Test all valid verbosity values
|
||||
for verbosity_level in ["low", "medium", "high"]:
|
||||
params = config.map_openai_params(
|
||||
non_default_params={"verbosity": verbosity_level},
|
||||
optional_params={},
|
||||
model="gpt-5.1",
|
||||
drop_params=False,
|
||||
)
|
||||
assert params["verbosity"] == verbosity_level
|
||||
|
||||
# Test with different GPT-5 models
|
||||
for model in ["gpt-5", "gpt-5.1", "gpt-5-mini", "gpt-5-nano", "gpt-5-codex"]:
|
||||
params = config.map_openai_params(
|
||||
non_default_params={"verbosity": "low"},
|
||||
optional_params={},
|
||||
model=model,
|
||||
drop_params=False,
|
||||
)
|
||||
assert params["verbosity"] == "low"
|
||||
def test_gpt5_1_reasoning_effort_none(config: OpenAIConfig):
|
||||
"""Test that GPT-5.1 supports reasoning_effort='none' parameter.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user