Support OpenAI Reasoning Models in the Model Adapter
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 48/100
- Issue 类型
- 功能
- 描述清晰度
- 基本清楚
- 活跃度
- 活跃
- 技术栈
- typescript
- 领域
- ai, backend-api-design
调研方向
Start with packages/models/src/providers/openai.ts around lines 138–160 and trace how the adapter builds request parameters and reads model sampling profiles. Check how existing tests construct standard model requests, then add coverage for reasoning and standard models as the work breakdown specifies. Done means the request fields match each model family’s requirements and the listed typecheck, test, and lint commands pass.
由索引模型根据 Issue 内容生成。
描述
Summary
Codra's OpenAI adapter in packages/models/src/providers/openai.ts unconditionally sends temperature and max_tokens to every OpenAI model. Modern OpenAI reasoning models including the o-series (o1, o3, o3-mini, o4-mini) and newer GPT-5/GPT-6 family models in reasoning mode reject these parameters and return HTTP 400 Bad Request, making it impossible to route Codra reviews to any OpenAI reasoning model.
This is the parent issue. See sub-issues for the specific implementation tasks.
Work Breakdown
- Sub-issue: Add reasoning model detection helper and conditional request body (covers
max_completion_tokensandrole: "developer") - Sub-issue: Add
reasoning_effortsupport via model sampling profile - Sub-issue: Tests for reasoning and standard model request construction
Affected File
packages/models/src/providers/openai.ts lines 138-160:
const bodyPayload: Record<string, unknown> = {
model,
messages: [
{ role: "system", content: prompts.system },
{ role: "user", content: prompts.user },
],
temperature, // rejected by o1, o3, o3-mini, o4-mini
max_tokens: effectiveCeiling, // must be max_completion_tokens for reasoning models
response_format: { type: "json_object" },
};
OpenAI Reasoning Model API Requirements
| Model family | temperature |
max_tokens |
max_completion_tokens |
reasoning_effort |
|---|---|---|---|---|
gpt-4o, gpt-4o-mini |
accepted | accepted | - | - |
gpt-5, gpt-5-mini |
accepted | accepted | - | - |
o1, o1-mini |
rejected | rejected | required | optional |
o3, o3-mini |
rejected | rejected | required | supported |
o4-mini |
rejected | rejected | required | supported |
gpt-6 (reasoning mode) |
rejected | rejected | required | supported |
Reasoning models generate internal chain-of-thought tokens before producing output. max_completion_tokens controls the ceiling over both reasoning and output tokens combined.
Done When
-
o1,o3,o3-mini,o4-minimodels receivemax_completion_tokensinstead ofmax_tokens -
temperatureis omitted for reasoning models -
role: "developer"replacesrole: "system"for reasoning model system prompts -
reasoning_effortis populated from the model sampling profile when available - Detection logic is forward-compatible (prefix-based, not a hardcoded list of model names)
- Standard models (
gpt-4o,gpt-4o-mini,gpt-5, custom base URLs) continue working unchanged - Tests cover reasoning model request construction and standard model construction
-
npm run typecheck,npm test, andnpm run lintall pass
- 主要语言
- TypeScript
- 星标
- 125
- 派生
- 23
- 平均合并
- 2 天 13 小时
- 30 天内合并 PR
- 12
环境准备
- 提供 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
devarshishimpi/codra 的其他 Issue
-
bug good first issue
难度 2/5 1-3 小时 新手友好度 84/100
devarshishimpi/codra#178 ·
维护者通常 1 天内回复
-
bug good first issue
难度 2/5 1-3 小时 新手友好度 78/100
devarshishimpi/codra#176 ·
维护者通常 1 天内回复
-
enhancement good first issue
难度 4/5 3-5 天 新手友好度 48/100
devarshishimpi/codra#186 ·
维护者通常 1 天内回复
-
enhancement good first issue
难度 4/5 3-5 天 新手友好度 55/100
devarshishimpi/codra#185 ·
维护者通常 1 天内回复
-
enhancement good first issue
难度 4/5 3-5 天 新手友好度 58/100
devarshishimpi/codra#184 ·
维护者通常 1 天内回复
查看 devarshishimpi/codra 的全部 Issue
相似的 Issue
-
bug
难度 2/5 1-3 小时 新手友好度 78/100
hemilabs/ui-monorepo#2711 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 76/100
code-yeongyu/senpi#6929 ·
维护者通常 1 天内回复
-
community first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
难度 1/5 1 小时以内 新手友好度 72/100
lingdojo/kana-dojo#34261 · 1 条评论 · 5 个 reaction ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 65/100
embedpdf/embed-pdf-viewer#1116 ·
维护者通常 1 天内回复
-
current task
难度 1/5 1-3 小时 新手友好度 88/100
Sunday-School-Software/Sunday-School-Scheduler#87 ·
维护者通常 1 天内回复