Support OpenAI Reasoning Models in the Model Adapter
Maintainer antworten meist innerhalb von 1 Tag
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Anfängerfreundlichkeit
- 48/100
- Issue-Typ
- Feature
- Klarheit
- Größtenteils klar
- Aktivitätsstatus
- Aktiv
- Tech-Stack
- typescript
- Bereich
- ai, backend-api-design
Rechercherichtung
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.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
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
- Vorherrschende Sprache
- TypeScript
- Sterne
- 125
- Forks
- 23
- Ø Merge
- 2 T. 13 Std.
- Gemergte PRs (30 T.)
- 12
Entwicklungsumgebung
- Enthält ein Dockerfile oder eine Docker-Compose-Datei
- Hat eine Pull-Request-Vorlage
- Beitragsleitfaden lesen
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus devarshishimpi/codra
-
bug good first issue
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 84/100
devarshishimpi/codra#178 ·
Maintainer antworten meist innerhalb von 1 Tag
-
bug good first issue
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
devarshishimpi/codra#176 ·
Maintainer antworten meist innerhalb von 1 Tag
-
enhancement good first issue
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 48/100
devarshishimpi/codra#186 ·
Maintainer antworten meist innerhalb von 1 Tag
-
enhancement good first issue
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 55/100
devarshishimpi/codra#185 ·
Maintainer antworten meist innerhalb von 1 Tag
-
enhancement good first issue
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 58/100
devarshishimpi/codra#184 ·
Maintainer antworten meist innerhalb von 1 Tag
Alle Issues in devarshishimpi/codra
Ähnliche Issues
-
agent-ready area: ui-server priority: p3 type: test
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
schlessera/brain-kit#4249 ·
Maintainer antworten meist innerhalb von 1 Tag
-
documentation tool triaged
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 73/100
can1357/oh-my-pi#19608 · 2 Kommentare ·
Maintainer antworten meist innerhalb von 1 Tag
-
dependencies tech-debt
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 65/100
bcgov/nr-waste-plus#1549 ·
Maintainer antworten meist innerhalb von 1 Tag
-
enhancement good first issue
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
blixvip/solana-token-meta#17 ·
-
enhancement good first issue
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
blixvip/solana-tx-parse#18 ·