Add Unit Tests for OpenAI Reasoning and Standard Requests

未關閉 適合新手
#178 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

維護者通常 1 天內回覆

還沒有人認領這個 Issue。

評估

難度
2/5
預估耗時
1-3 小時
新手友好度
84/100
Issue 類型
功能
描述清晰度
描述清楚
活躍度
活躍
技術堆疊
typescript
領域
testing

研究方向

從packages/models/src/providers/openai.ts開始,找出現有的測試檔案和 OpenAI provider 的測試命令設定。為推理模型和標準模型新增請求結構測試,包含偵測和reasoning_effort相關案例。測試納入npm test,且列出的型別檢查、測試和 lint 命令都通過後,即代表完成。

由索引模型根據 Issue 內容生成。

描述

bug good first issue

Goal

Add unit tests covering both the reasoning-model and standard-model request construction paths in the OpenAI adapter (packages/models/src/providers/openai.ts).

Background

The OpenAI adapter is gaining conditional request payloads for reasoning models (see sibling sub-issues). The branching logic (which parameters are sent for which model family) is exactly the kind of code that silently regresses, so it needs dedicated test coverage.

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

What to Test

  • isOpenAIReasoningModel returns true for o1, o3, o3-mini, o4-mini, and gpt-6 style identifiers
  • isOpenAIReasoningModel returns false for gpt-4o, gpt-4o-mini, gpt-5, and custom-named models
  • Reasoning model payloads contain max_completion_tokens, no temperature, no max_tokens, and use role: "developer" for the system prompt
  • Standard model payloads contain temperature and max_tokens as before
  • reasoning_effort mapping: numeric budget thresholds (low/medium/high), string passthrough, and absent-budget omission
  • response_format stays { type: "json_object" } in both branches

Done When

  • Unit tests cover the detection helper for both true and false cases
  • Unit tests cover both payload branches with request-shape assertions
  • Unit tests cover all reasoning_effort mapping cases and the absent-budget case
  • Tests run as part of the existing npm test suite
  • npm run typecheck, npm test, and npm run lint all pass
主要語言
TypeScript
星號
125
分支
23
平均合併
2 天 13 小時
30 天內合併 PR
12

環境準備

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

devarshishimpi/codra 的其他 Issue

查看 devarshishimpi/codra 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。