Detect OpenAI Reasoning Models and Adjust Request Payload
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 78/100
- issue の種類
- 機能追加
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- typescript
調査の方向性
issueによるとリクエストのペイロードが構築される packages/models/src/providers/openai.ts から始め、issueで説明されているモデル検出ヘルパーと条件付きペイロードフィールドを追加してください。まず既存のペイロード構築処理と近くのテストを確認し、その後、推論モデルと標準モデルの分岐をカバーするテストを追加してください。両方の分岐で指定されたフィールドとプロンプトのロールが使われ、要求されたtypecheck、test、lintの各コマンドが成功すれば完了です。
索引モデルが issue の本文から書いたものです。
説明
Goal
Add a helper function that detects whether an OpenAI model identifier refers to a reasoning model, and use it to conditionally adjust the request payload sent in packages/models/src/providers/openai.ts.
Background
OpenAI reasoning models (o1, o3, o3-mini, o4-mini, and future variants) reject the temperature parameter and require max_completion_tokens instead of max_tokens. The current adapter sends both unconditionally, causing HTTP 400 errors for any reasoning model.
This sub-issue is part of the parent issue: OpenAI adapter incompatible with reasoning models.
What to Build
Add an isOpenAIReasoningModel(model: string): boolean helper in the openai provider:
function isOpenAIReasoningModel(model: string): boolean {
const lower = model.toLowerCase();
return (
/^o\d/.test(lower) || // o1, o3, o3-mini, o4-mini, o5, etc.
lower.includes("-reasoning") || // possible future naming convention
lower.startsWith("gpt-6") // gpt-6 and variants when in reasoning mode
);
}
Then update the body payload construction to branch on isReasoning:
const isReasoning = isOpenAIReasoningModel(model);
const bodyPayload: Record<string, unknown> = {
model,
messages: [
{ role: isReasoning ? "developer" : "system", content: prompts.system },
{ role: "user", content: prompts.user },
],
...(isReasoning
? { max_completion_tokens: effectiveCeiling }
: { temperature, max_tokens: effectiveCeiling }),
response_format: { type: "json_object" },
};
Done When
-
isOpenAIReasoningModelcorrectly identifies o-series and gpt-6 models - Standard models (
gpt-4o,gpt-5, custom endpoints) return false and are unaffected - Reasoning models receive
max_completion_tokensand notemperature - Standard models receive
temperatureandmax_tokensas before -
role: "developer"is used for the system prompt on reasoning models - Unit tests cover the detection helper and both branches of the payload builder
-
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 日以内に返信
-
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 日以内に返信
-
enhancement good first issue
難易度 3/5 1〜2日 初心者へのやさしさ 62/100
devarshishimpi/codra#183 ·
メンテナーはふだん 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 日以内に返信