Add OpenAI chat-latest support and generalize token handling#969
Add OpenAI chat-latest support and generalize token handling#969PeterDaveHello wants to merge 1 commit intoChatGPTBox-dev:masterfrom
Conversation
Add the chat-latest OpenAI API preset. Broaden the OpenAI token-parameter helper naming so chat-latest can share the max_completion_tokens path with GPT-5 latest models. Reference: - https://developers.openai.com/api/docs/models/chat-latest
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (5)
📝 WalkthroughWalkthroughThis PR introduces support for a new OpenAI "chat-latest" model by registering it in the config, updating token parameter selection to use ChangesOpenAI Chat Latest Model Addition
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Review Summary by QodoAdd OpenAI chat-latest model support and generalize token handling
WalkthroughsDescription• Add OpenAI chat-latest model support to configuration • Generalize token parameter handling for latest models • Rename pattern and variables to reflect broader applicability • Expand test coverage for chat-latest model scenarios Diagramflowchart LR
A["chat-latest Model"] --> B["Config Registration"]
B --> C["Token Parameter Logic"]
C --> D["max_completion_tokens Pattern"]
A --> E["Test Coverage"]
E --> F["Model Compatibility Tests"]
File Changes1. src/config/index.mjs
|
There was a problem hiding this comment.
Code Review
This pull request adds support for the chat-latest OpenAI model by updating the configuration, logic for token parameters, and relevant unit tests. Specifically, it ensures that the chat-latest model uses max_completion_tokens instead of max_tokens and updates naming conventions in tests to be more generic. I have no feedback to provide.
There was a problem hiding this comment.
Pull request overview
Adds support for OpenAI’s chat-latest model in the API presets and extends the existing “use max_completion_tokens” behavior (previously focused on GPT‑5 chat models) so chat-latest follows the same token-parameter path.
Changes:
- Add a new preset model key/value (
chatgptApiChatLatest→chat-latest) in config and model-name conversion coverage. - Generalize the OpenAI token-parameter matcher to treat
chat-latestlike GPT‑5.* models formax_completion_tokens. - Expand unit tests to validate the new model mapping and token-param selection (including ensuring lookalikes still use
max_tokens).
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| tests/unit/utils/model-name-convert.test.mjs | Adds coverage that the new preset key maps to chat-latest. |
| tests/unit/services/apis/openai-token-params.test.mjs | Adds coverage for chat-latest using max_completion_tokens and ensures lookalikes don’t match. |
| tests/unit/services/apis/openai-api-compat.test.mjs | Extends “latest compat model” cases to include chat-latest and updates naming/loops accordingly. |
| src/services/apis/openai-token-params.mjs | Generalizes the OpenAI model pattern to include chat-latest. |
| src/config/index.mjs | Adds the new chatgptApiChatLatest preset key to the OpenAI API model list and Models map. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Add the chat-latest OpenAI API preset.
Broaden the OpenAI token-parameter helper naming so chat-latest can share the max_completion_tokens path with GPT-5 latest models.
Reference:
Summary by CodeRabbit