Map Thinking Budget to Reasoning Effort for OpenAI Models

オープン
#177 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
65/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
活発
技術スタック
typescript

調査の方向性

Start by locating the OpenAI adapter and the sibling issue's isReasoning branch, then read how it builds bodyPayload and accesses the model sampling profile. Add the specified thinkingBudget mapping and cover numeric thresholds, string values, absent budgets, and standard models in tests. Done when those tests and the listed typecheck, test, and lint commands pass.

索引モデルが issue の本文から書いたものです。

説明

bug good first issue

Goal

Add reasoning_effort parameter support to the OpenAI adapter for reasoning models that accept it (o3, o3-mini, o4-mini, gpt-6).

Background

OpenAI's reasoning models accept a reasoning_effort parameter with values "low", "medium", or "high" that controls how many internal thinking tokens the model uses. Currently Codra sends no such parameter and cannot tune the cost/quality tradeoff for reasoning model calls.

This sub-issue is part of the parent issue: OpenAI adapter incompatible with reasoning models.

What to Build

After the isReasoning branch is in place (see sibling sub-issue), read the thinkingBudget from the model's sampling profile and map it to reasoning_effort:

if (isReasoning && sampling?.thinkingBudget) {
  let effort: "low" | "medium" | "high" | undefined;

  if (typeof sampling.thinkingBudget === "number") {
    effort =
      sampling.thinkingBudget > 10000 ? "high"
      : sampling.thinkingBudget > 3000 ? "medium"
      : "low";
  } else if (
    sampling.thinkingBudget === "low" ||
    sampling.thinkingBudget === "medium" ||
    sampling.thinkingBudget === "high"
  ) {
    effort = sampling.thinkingBudget;
  }

  if (effort) {
    bodyPayload.reasoning_effort = effort;
  }
}

Done When

  • reasoning_effort is included in requests to supported reasoning models when a thinking budget is configured
  • Numeric budgets are mapped to low/medium/high correctly
  • String values low/medium/high are passed through directly
  • The parameter is omitted when no thinking budget is configured
  • Standard (non-reasoning) models are not affected
  • Tests cover all mapping cases and the absent-budget case
  • npm run typecheck, npm test, and npm run lint all pass
主要言語
TypeScript
スター
125
フォーク
23
平均マージ
2日 13時間
マージ済み PR(30日)
12

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

devarshishimpi/codra のほかの issue

devarshishimpi/codra の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。