Skip to content

Conversation

@RomneyDa
Copy link
Collaborator

@RomneyDa RomneyDa commented Aug 7, 2025

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.

  • New Features
    • GPT-5 now appears as an option when adding a new model.
    • Updated API logic to handle GPT-5-specific message formatting and token parameters.
    • Enabled function/tool support for GPT-5 models.

@RomneyDa RomneyDa requested a review from a team as a code owner August 7, 2025 20:18
@RomneyDa RomneyDa requested review from Patrick-Erichsen and removed request for a team August 7, 2025 20:18
@dosubot dosubot bot added the size:M This PR changes 30-99 lines, ignoring generated files. label Aug 7, 2025
@github-project-automation github-project-automation bot moved this from Todo to In Progress in Issues and PRs Aug 7, 2025
@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Aug 7, 2025
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a 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,
Copy link
Contributor

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 &#39;gpt-5&#39; 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&#39;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: &quot;gpt-5&quot;,
+      displayName: &quot;GPT-5&quot;,
+      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)) {
Copy link
Contributor

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&#39;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"],
Copy link
Contributor

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: &quot;gpt-5&quot;,
+      displayName: &quot;GPT-5&quot;,
+      contextLength: 400000,
+      maxCompletionTokens: 128000,
</file context>
Suggested change
recommendedFor: ["chat"],
maxCompletionTokens: 4096,

@Patrick-Erichsen
Copy link
Collaborator

@TyDunn beat you to it 😎

@RomneyDa RomneyDa merged commit 01812e5 into main Aug 7, 2025
38 checks passed
@RomneyDa RomneyDa deleted the dallin/gpt-5 branch August 7, 2025 20:36
@github-project-automation github-project-automation bot moved this from In Progress to Done in Issues and PRs Aug 7, 2025
@github-actions github-actions bot locked and limited conversation to collaborators Aug 7, 2025
@github-actions github-actions bot added the tier 2 Important feature that adds new capabilities to the platform or improves critical user journeys label Aug 7, 2025
@TyDunn
Copy link
Contributor

TyDunn commented Aug 7, 2025

@Patrick-Erichsen Did you actually try it out locally though? 😉

./scripts/oneper install --pr 7054

@sestinj
Copy link
Contributor

sestinj commented Aug 18, 2025

🎉 This PR is included in version 1.5.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@sestinj
Copy link
Contributor

sestinj commented Aug 18, 2025

🎉 This PR is included in version 1.7.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

lgtm This PR has been approved by a maintainer released size:M This PR changes 30-99 lines, ignoring generated files. tier 2 Important feature that adds new capabilities to the platform or improves critical user journeys

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

5 participants