-
Notifications
You must be signed in to change notification settings - Fork 4.1k
feat: gpt-5 support #7054
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: gpt-5 support #7054
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cubic analysis
3 issues found across 6 files • Review in cubic
React with 👍 or 👎 to teach cubic. You can also tag @cubic-dev-ai to give feedback, ask questions, or re-run the review.
| { | ||
| model: "gpt-5", | ||
| displayName: "GPT-5", | ||
| contextLength: 400000, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are multiple, conflicting sources of truth for model configuration. The context length for 'gpt-5' is defined as 400,000 here, but it is set to 128,000 in gui/src/pages/AddNewModel/configs/models.ts. This inconsistency can lead to unpredictable behavior and bugs, as different parts of the system will operate with different assumptions about the model's capabilities. Architecturally, model metadata should be centralized in a single package (like llm-info) and consumed by other parts of the application (like the GUI) to ensure consistency.
Prompt for AI agents
Address the following comment on packages/llm-info/src/providers/openai.ts at line 82:
<comment>There are multiple, conflicting sources of truth for model configuration. The context length for 'gpt-5' is defined as 400,000 here, but it is set to 128,000 in `gui/src/pages/AddNewModel/configs/models.ts`. This inconsistency can lead to unpredictable behavior and bugs, as different parts of the system will operate with different assumptions about the model's capabilities. Architecturally, model metadata should be centralized in a single package (like `llm-info`) and consumed by other parts of the application (like the GUI) to ensure consistency.</comment>
<file context>
@@ -75,6 +75,15 @@ export const OpenAi: ModelProvider = {
contextLength: 128000,
maxCompletionTokens: 4096,
},
+ // gpt-5
+ {
+ model: "gpt-5",
+ displayName: "GPT-5",
+ contextLength: 400000,
+ maxCompletionTokens: 128000,
</file context>
|
|
||
| // OpenAI o1-preview and o1-mini or o3-mini: | ||
| if (this.isOSeriesModel(options.model)) { | ||
| if (this.isOSeriesOrGpt5Model(options.model)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The logic for adapting requests for specific OpenAI models (O-series and GPT-5) is duplicated in multiple locations. This same logic exists in packages/openai-adapters/src/apis/OpenAI.ts. This violates the DRY (Don't Repeat Yourself) principle and creates a maintenance burden. If the adaptation requirements change or a new model needs similar handling, the changes must be manually synchronized across different packages. This logic should be centralized into a single adapter or middleware that handles all outgoing requests to the OpenAI API, ensuring that model-specific quirks are handled consistently.
Prompt for AI agents
Address the following comment on core/llm/llms/OpenAI.ts at line 142:
<comment>The logic for adapting requests for specific OpenAI models (O-series and GPT-5) is duplicated in multiple locations. This same logic exists in `packages/openai-adapters/src/apis/OpenAI.ts`. This violates the DRY (Don't Repeat Yourself) principle and creates a maintenance burden. If the adaptation requirements change or a new model needs similar handling, the changes must be manually synchronized across different packages. This logic should be centralized into a single adapter or middleware that handles all outgoing requests to the OpenAI API, ensuring that model-specific quirks are handled consistently.</comment>
<file context>
@@ -139,13 +139,13 @@ class OpenAI extends BaseLLM {
finalOptions.stop = options.stop?.slice(0, this.getMaxStopWords());
// OpenAI o1-preview and o1-mini or o3-mini:
- if (this.isOSeriesModel(options.model)) {
+ if (this.isOSeriesOrGpt5Model(options.model)) {
// a) use max_completion_tokens instead of max_tokens
finalOptions.max_completion_tokens = options.maxTokens;
</file context>
| contextLength: 400000, | ||
| maxCompletionTokens: 128000, | ||
| regex: /gpt-5/, | ||
| recommendedFor: ["chat"], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The gpt-4o and gpt-4o-mini model definitions are missing the maxCompletionTokens property. While this property is optional in the LlmInfo interface, it is a critical parameter for large language models, defining the maximum number of tokens the model can generate in a completion. Without this value explicitly set, any part of the application that relies on maxCompletionTokens for these models will either use an incorrect default, infer an incorrect value, or fail to function as expected. This can lead to issues such as truncated responses, increased costs, or runtime errors.
Prompt for AI agents
Address the following comment on packages/llm-info/src/providers/openai.ts at line 85:
<comment>The `gpt-4o` and `gpt-4o-mini` model definitions are missing the `maxCompletionTokens` property. While this property is optional in the `LlmInfo` interface, it is a critical parameter for large language models, defining the maximum number of tokens the model can generate in a completion. Without this value explicitly set, any part of the application that relies on `maxCompletionTokens` for these models will either use an incorrect default, infer an incorrect value, or fail to function as expected. This can lead to issues such as truncated responses, increased costs, or runtime errors.</comment>
<file context>
@@ -75,6 +75,15 @@ export const OpenAi: ModelProvider = {
contextLength: 128000,
maxCompletionTokens: 4096,
},
+ // gpt-5
+ {
+ model: "gpt-5",
+ displayName: "GPT-5",
+ contextLength: 400000,
+ maxCompletionTokens: 128000,
</file context>
| recommendedFor: ["chat"], | |
| maxCompletionTokens: 4096, |
|
@TyDunn beat you to it 😎 |
|
@Patrick-Erichsen Did you actually try it out locally though? 😉
|
|
🎉 This PR is included in version 1.5.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
|
🎉 This PR is included in version 1.7.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Description
Support for gpt 5 family of models
Summary by cubic
Added support for the GPT-5 model across the app, including model selection, API handling, and tool support.