Add Unit Tests for OpenAI Reasoning and Standard Requests

Open Beginner friendly
#178 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
84/100
Issue type
Feature
Clarity
Clearly specified
Activity status
Active
Tech stack
typescript
Domain
testing

Research direction

Start with packages/models/src/providers/openai.ts and find the existing test files and test command configuration for the OpenAI provider. Add request-shape tests for reasoning and standard models, including detection and reasoning_effort cases. Done means the tests are included in npm test and the listed typecheck, test, and lint commands pass.

Written by the indexing model from the issue text.

Description

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
Dominant language
TypeScript
Stars
125
Forks
23
Avg merge
2d 13h
Merged PRs (30d)
12

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from devarshishimpi/codra

All issues in devarshishimpi/codra

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.