Support OpenAI Reasoning Models in the Model Adapter
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 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時間
- マージ済み PR(30日)
- 12
環境構築
- Dockerfile または Docker Compose ファイルあり
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- 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
-
難易度 1/5 1〜3時間 初心者へのやさしさ 83/100
gofish-graphics/gofish-graphics#1384 ·
メンテナーはふだん 1 日以内に返信
-
adapter bug
難易度 2/5 1〜3時間 初心者へのやさしさ 83/100
Olanetsoft/agent-lookout#353 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
vicharanashala/vibe#1542 ·
メンテナーはふだん 1 日以内に返信
-
bug chore P2 size:XS
難易度 2/5 1〜3時間 初心者へのやさしさ 77/100
josephfung/curia#2666 ·
メンテナーはふだん 1 日以内に返信
-
area: batch
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
inabagumi/shinju-date#7294 ·
メンテナーはふだん 1 日以内に返信