Skip to content

Fix None-valued OpenAI request params for GPT-5 models#136

Merged
Moskize91 merged 3 commits into
mainfrom
fix/omit-none-llm-params
May 8, 2026
Merged

Fix None-valued OpenAI request params for GPT-5 models#136
Moskize91 merged 3 commits into
mainfrom
fix/omit-none-llm-params

Conversation

@Moskize91

Copy link
Copy Markdown
Contributor

Summary

  • omit None-valued request parameters before calling chat.completions.create
  • prevent max_tokens=null from being sent to GPT-5 models, which reject it with a 400 error
  • bump package version to 0.1.10

Testing

  • not run

Closes #135

@coderabbitai

coderabbitai Bot commented May 8, 2026

Copy link
Copy Markdown

Review Change Stack
No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 55df95ac-7cd1-4f9e-bd38-4f2e110b81b2

📥 Commits

Reviewing files that changed from the base of the PR and between b976c21 and a1b7ec0.

📒 Files selected for processing (1)
  • epub_translator/llm/executor.py

Summary by CodeRabbit

  • Chores

    • Version bumped to 0.1.10
  • Internal Improvements

    • Improved handling of optional AI request parameters to avoid sending unset values (no user-facing behavior changes).

Walkthrough

The OpenAI import in epub_translator.llm.executor now includes omit, and the chat.completions.create call passes openai.omit for top_p, temperature, and max_tokens when those values are None instead of passing nulls. Streaming behavior and usage reporting are unchanged. The package version in pyproject.toml is bumped from 0.1.9 to 0.1.10.

Sequence Diagram(s)

sequenceDiagram
  participant Executor
  participant OpenAI
  Executor->>OpenAI: chat.completions.create(model, messages, top_p: value|omit, temperature: value|omit, max_tokens: value|omit, stream=True)
  OpenAI-->>Executor: stream chunks
  Executor->>Executor: accumulate chunks
  Executor->>Executor: submit_usage(chunk.usage)
Loading
🚥 Pre-merge checks | ✅ 3 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Title check ⚠️ Warning The title does not follow the required format '(): ' and is missing both type prefix and scope. Reformat the title to follow the conventional commit format, e.g., 'fix(llm): omit None-valued OpenAI request params for GPT-5 models'.
✅ Passed checks (3 passed)
Check name Status Explanation
Description check ✅ Passed The description is directly related to the changeset, detailing the purpose of omitting None parameters and version bump.
Linked Issues check ✅ Passed The PR successfully addresses issue #135 by using openai.omit to prevent None-valued parameters like max_tokens from being sent to GPT-5 models.
Out of Scope Changes check ✅ Passed All changes are in-scope: OpenAI parameter omission in executor.py and version bump in pyproject.toml align with the linked issue requirements.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch fix/omit-none-llm-params

Comment @coderabbitai help to get the list of available commands and usage tips.

@Moskize91 Moskize91 merged commit f3d32d7 into main May 8, 2026
2 checks passed
@Moskize91 Moskize91 deleted the fix/omit-none-llm-params branch May 8, 2026 03:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

gpt-5 models issue

1 participant