feat(provider): add GPT-5 text.verbosity control for Responses API (sa-72) - #2517
Merged
Merged
Conversation
…a-72)
GPT-5 models accept a `text.verbosity` output-length hint that is
independent of reasoning_effort, but ggcode's Responses adapter had no
way to send it. Add the full pipeline:
- config: `text_verbosity` endpoint field + ResolvedEndpoint plumbing
- provider: TextVerbosityProvider interface; OpenAIResponsesProvider
stores the hint and emits `text: {verbosity: ...}` on requests
- registry: applies the field for both `openai-responses` and the
/responses URL-sniff fallback paths
- fallback chain: SetTextVerbosity/TextVerbosity delegation
- resilience: when an OpenAI-compatible gateway rejects the parameter
as unknown/unsupported (pre-GPT-5 relays), drop the hint once and
retry instead of hard-failing the request
- docs: providers.md Text Verbosity section
- tests: setter validation, wire format, omission when unset,
rejected-parameter retry, unrelated-error no-retry, matcher table,
registry integration
Co-Authored-By: ggcode <noreply@ggcode.dev>
Co-Authored-By: ggcode <noreply@ggcode.dev>
Assert yaml field parses and ResolveEndpoint trims the hint like reasoning_effort/tool_choice; empty case stays empty. Co-Authored-By: ggcode <noreply@ggcode.dev>
topcheer
commented
Sep 18, 2026
topcheer
left a comment
Owner
Author
There was a problem hiding this comment.
复审通过 ✅(两重点核销)
① 值域校验+拒收自愈双保险:setter 白名单(low/medium/high,未知值忽略保既有——镜像 effort setters 形态防 typo 清空);网关侧:旧 OpenAI 兼容网关拒未知参数→responsesRejectsVerbosity 探测→drop text 域单次重试——verbosity 配置降级 API 默认而非硬失败(比 #2488 的静态 latch 更优的按需降级)。
② 与 #2473 effort 正交:text.verbosity 与 reasoning.effort 是不同顶层子对象(req.Text vs req.Reasoning)——域分离零触碰;缓存前缀:两者同属 params 层配置(非 per-turn 抖动)——verbosity 变化同 effort 一样不保缓存前缀(#2473 注释的既有语义自然延伸,配置级变更用户域)。docs 明示分工(verbosity=长度/effort=深度——概念混淆防)。
FallbackProvider 链式传播。CI 9/9 绿。可合并。
5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
text_verbosityendpoint config (low/medium/high) flowing throughResolvedEndpointinto the OpenAI Responses providertext: {verbosity}on requests; independent ofreasoning_effortTextVerbosityProviderinterface + fallback-chain delegationtext.verbosityas an unknown parameter (pre-GPT-5 relays) trigger a single drop-and-retrydocs/guide/providers.mdTests
7 new tests in
internal/provider/openai_responses_verbosity_test.go: setter validation, wire format, field omission when unset, rejected-parameter retry, unrelated-error no-retry, matcher table, registry integration.go build/go vet/gofmtclean, packages pass on darwin/arm64; windows+amd64 vet clean.Co-Authored-By: ggcode noreply@ggcode.dev