Skip to content

Conversation

azdaev
Copy link
Contributor

@azdaev azdaev commented Aug 11, 2025

Add Verbosity parameter to Chat Completion Request

Verbosity - Constrains the verbosity of the model's response. Lower values will result in more concise responses, while higher values will result in more verbose responses. Currently supported values are low, medium, and high.

OpenAI Docs - https://platform.openai.com/docs/api-reference/chat/create#chat_create-verbosity

Testing

✅ All existing tests pass

Copy link

codecov bot commented Aug 11, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.59%. Comparing base (f71d1a6) to head (bd1cc52).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1064   +/-   ##
=======================================
  Coverage   99.59%   99.59%           
=======================================
  Files          34       34           
  Lines        2206     2206           
=======================================
  Hits         2197     2197           
  Misses          6        6           
  Partials        3        3           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@sashabaranov
Copy link
Owner

Hey @azdaev, thank you for the PR! I don't see the verbosity in the OpenAI docs link you've provided, and if I search for it I get to this page: https://platform.openai.com/docs/guides/latest-model#verbosity

This page says that it's supported in the client.responses.create API, which we haven't implemented in this library yet.

Please lmk if this parameter is supported in the chat completions API and is not documented.

Also, is this option only available for GPT-5?

@azdaev
Copy link
Contributor Author

azdaev commented Aug 19, 2025

@sashabaranov This is weird, but the verbosity parameter is now gone from the API Reference of Chat Completion. I've attached the link in my first message but now verbosity just isn't there. However, it still is working.
image

Verbosity definitely works with "gpt-5-mini", "gpt-5", "gpt-5-nano" as I have tested. It definitely isn't supported by "gpt-4.1-mini". Docs are too vague about Verbosity, so I had to check for myself.

@sashabaranov
Copy link
Owner

@azdaev got it, thanks! Could we please add a note about that in the comment for this field?

@azdaev
Copy link
Contributor Author

azdaev commented Aug 19, 2025

@sashabaranov no problem! done! feel free to edit the noe if it doesn't satisfy you

@aleiva17
Copy link

Hey @azdaev, thank you for the PR! I don't see the verbosity in the OpenAI docs link you've provided, and if I search for it I get to this page: https://platform.openai.com/docs/guides/latest-model#verbosity

This page says that it's supported in the client.responses.create API, which we haven't implemented in this library yet.

Please lmk if this parameter is supported in the chat completions API and is not documented.

Also, is this option only available for GPT-5?

It's not being displayed in that page, but if you install the official openai go sdk (v2), it's available as part of the completions API:

client := openai.NewClient()

resp, err := client.Chat.Completions.New(ctx,
	openai.ChatCompletionNewParams{
		Model: openai.ChatModelGPT5,
		// ...
		Verbosity: openai.ChatCompletionNewParamsVerbosityHigh,
	},
)

@sashabaranov sashabaranov merged commit 8e5611c into sashabaranov:master Aug 29, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants