fix(provider): 修复 Chat reasoning_effort 值域与 Responses 扩展透传#620
Merged
Conversation
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.
背景
OpenAI Chat Completions 只接受
reasoning_effort为low、medium、high。当 Responses、Claude Messages、Gemini 或模型后缀指令产生xhigh/max后,再转换到 OpenAI Chat 时会透传非法值,导致上游返回 400。同时,Responses 请求转换到 Chat 时,部分 Responses-only 字段可能被透传到 Chat 请求体,存在兼容性风险。
变更内容
修复 OpenAI Chat request 输出的
reasoning_effort值域:low保持为lowmedium保持为mediumhigh保持为highxhigh/max转换为high覆盖所有转 Chat 的来源路径:
reasoning.effort=xhigh-> Chatreasoning_effort=highoutput_config.effort=max-> Chatreasoning_effort=highxhigh-> Chatreasoning_effort=high-xhigh/-max用于 OpenAI Chat 时收敛为high过滤 Responses -> Chat 的扩展字段透传:
verbosity、service_tier、prompt_cache_key、safety_identifier、userinclude、store、text、reasoning补充回归测试:
xhigh收敛和扩展字段过滤max收敛xhigh收敛xhigh收敛测试
cargo test -p aether-ai-formats