Repository navigation
refactor: share reasoning effort and budget mapping - #383
Merged
eric8810 merged 8 commits intoOct 28, 2026
Merged
Conversation
Ports mapReasoningToProviderEffort, mapReasoningToProviderBudget and their defaults from @ai-sdk/provider-utils 5.0.55, with the upstream test cases (the `max` level has no aimux counterpart). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0116HPMoqaLfFr1TyqDq1hrW
…pers Anthropic, Amazon Bedrock, Cohere, DeepSeek, Google, Groq, Mistral and xAI call map_reasoning_to_provider_effort/_budget where upstream does, keeping only their effort maps and budget limits. Requests and warnings are unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0116HPMoqaLfFr1TyqDq1hrW
…ffort Open Responses now maps the top-level reasoning level with map_reasoning_to_provider_effort, so sending `minimal` as `low` adds the compatibility warning upstream emits. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0116HPMoqaLfFr1TyqDq1hrW
…ning Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0116HPMoqaLfFr1TyqDq1hrW
30 of 57 tasks
cunninghamcard-bit
marked this pull request as ready for review
October 27, 2026 22:23
eric8810
approved these changes
Oct 27, 2026
eric8810
left a comment
Contributor
There was a problem hiding this comment.
budget 公式和九家 effort 表逐项一致;不可达分支审计通过;Open Responses minimal 的 compatibility warning 是有意修正并有测试。Approve。
…oning-effort-and-budget-mapping # Conflicts: # aimux-provider-utils/src/tests/mod.rs
…oning-effort-and-budget-mapping # Conflicts: # aimux-provider-utils/src/tests/mod.rs
…oning-effort-and-budget-mapping
Contributor
Author
…oning-effort-and-budget-mapping # Conflicts: # aimux-provider-utils/src/tests/mod.rs
Contributor
Author
Generated by Claude Code |
eric8810
approved these changes
Oct 28, 2026
eric8810
left a comment
Contributor
There was a problem hiding this comment.
Rebase 仅 union tests/mod.rs,diff 与批准时一致,16/16 CI 通过。Re-approve。
This was referenced Oct 28, 2026
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.
RFC-0046 R1 的第 5 个小 PR(清单见 #328):把
mapReasoningToProviderEffort和mapReasoningToProviderBudget放进aimux-provider-utils,9 家厂商按上游的调用点改用它们。Before:顶层
reasoning等级到厂商参数的换算在各家各写一份。Anthropic 有map_reasoning_to_effort、reasoning_budget_percentage、map_reasoning_to_budget三个函数,Cohere 又有一份reasoning_budget_percentage和DEFAULT_REASONING_MAX_TOKENS,Bedrock、DeepSeek、Google、Groq、Mistral、xAI、Open Responses 各自用match换算并自己拼警告文字。Open Responses 把minimal发成low时不出警告。After:9 家都调用同一对函数,各自只保留上游写在调用点的那张等级表或预算上限。警告文字只有一处。Open Responses 把
minimal发成low时出compatibility警告,与上游一致。一、体系现状(概览)
上游:
aimux(master b0450d4):
二、本 PR 改动(细节)
测试:
src/tests/map_reasoning_to_provider.rsmax那条没有对应等级,未移植;“所有等级”一条标 partial(少max)tests/responses/language_model.rsminimal发成low并出 compatibility 警告;在 master 上失败其余厂商的已有用例全部原样通过,请求体和警告不变。工作区测试 4380 → 4381(provider-utils 的 14 个另计)。
改动规模:
公开 API 与行为
aimux_provider_utils::map_reasoning_to_provider_effort、map_reasoning_to_provider_budget、DEFAULT_REASONING_BUDGET_PERCENTAGES、DEFAULT_MIN_REASONING_BUDGET。reasoning等级时出 compatibility 警告。检查
cargo fmt --check、scripts/check_provider_boundaries.sh、cargo +1.99 clippy(providers 与 provider-utils,-D warnings)、cargo check --workspace、cargo doc、全部测试均通过。Generated by Claude Code