AutoGPT icon indicating copy to clipboard operation
AutoGPT copied to clipboard

Add GPT-4o Mini model to OpenAI provider

Open radleta opened this issue 1 year ago • 9 comments
trafficstars

User description

Background

The addition of the GPT-4o Mini model to the OpenAI provider will enhance the application's capabilities by providing a model with a higher token limit and support for the function call API. This is necessary for users requiring extensive token usage and advanced API functionalities.

Link to the issue: Add gpt-4o-mini #7479

Changes 🏗️

This pull request includes:

  • Adding the GPT-4o Mini model to the OpenAI provider in the openai.py file.
    • Prompt token cost: 0.15/1,000,000
    • Completion token cost: 0.6/1,000,000
    • Maximum token limit: 128,000
    • Support for function call API

PR Quality Scorecard ✨

  • [x] Have you used the PR description template?   +2 pts
  • [x] Is your pull request atomic, focusing on a single change?   +5 pts
  • [x] Have you linked the GitHub issue(s) that this PR addresses?   +5 pts
  • [x] Have you documented your changes clearly and comprehensively?   +5 pts
  • [ ] Have you changed or added a feature?   -4 pts
    • [ ] Have you added/updated corresponding documentation?   +4 pts
    • [ ] Have you added/updated corresponding integration tests?   +5 pts
  • [ ] Have you changed the behavior of AutoGPT?   -5 pts
    • [ ] Have you also run agbenchmark to verify that these changes do not regress performance?   +10 pts

PR Type

Enhancement


Description

  • Added the GPT-4o Mini model to the OpenAI provider in the openai.py file.
  • Defined new model names GPT4_O_MINI_v1, GPT4_O_MINI_ROLLING, and GPT4_O_MINI.
  • Set prompt token cost to 0.15/1,000,000 and completion token cost to 0.6/1,000,000 for GPT-4o Mini.
  • Established a maximum token limit of 128,000 for GPT-4o Mini.
  • Enabled support for the function call API for the GPT-4o Mini model.

Changes walkthrough 📝

Relevant files
Enhancement
openai.py
Add GPT-4o Mini model to OpenAI provider                                 

forge/forge/llm/providers/openai.py

  • Added new GPT-4o Mini model to the OpenAI provider.
  • Defined new model names and mapping for GPT-4o Mini.
  • Set token costs and maximum token limit for GPT-4o Mini.
  • Enabled function call API support for GPT-4o Mini.
  • +12/-0   

    💡 PR-Agent usage: Comment /help on the PR to get a list of all available PR-Agent tools and their descriptions

    radleta avatar Aug 04 '24 23:08 radleta

    Deploy Preview for auto-gpt-docs ready!

    Name Link
    Latest commit 28d3d16fc4e482124e6ccdc54fd97e85ebd19cc6
    Latest deploy log https://app.netlify.com/sites/auto-gpt-docs/deploys/66c5be3af97e20000781fe1d
    Deploy Preview https://deploy-preview-7694--auto-gpt-docs.netlify.app
    Preview on mobile
    Toggle QR Code...

    QR Code

    Use your smartphone camera to open QR code link.

    To edit notification comments on pull requests, go to your Netlify site configuration.

    netlify[bot] avatar Aug 04 '24 23:08 netlify[bot]

    Codecov Report

    All modified and coverable lines are covered by tests :white_check_mark:

    Project coverage is 57.88%. Comparing base (0767b17) to head (28d3d16). Report is 222 commits behind head on master.

    Additional details and impacted files
    @@            Coverage Diff             @@
    ##           master    #7694      +/-   ##
    ==========================================
    + Coverage   49.63%   57.88%   +8.25%     
    ==========================================
      Files         146      106      -40     
      Lines        8926     5768    -3158     
      Branches     1242      720     -522     
    ==========================================
    - Hits         4430     3339    -1091     
    + Misses       4348     2316    -2032     
    + Partials      148      113      -35     
    
    Flag Coverage Δ
    Linux 57.88% <100.00%> (+8.44%) :arrow_up:
    Windows ?
    agbenchmark ?
    autogpt-agent ?
    forge 57.88% <100.00%> (-0.16%) :arrow_down:
    macOS ?

    Flags with carried forward coverage won't be shown. Click here to find out more.

    :umbrella: View full report in Codecov by Sentry.
    :loudspeaker: Have feedback on the report? Share it here.

    codecov[bot] avatar Aug 04 '24 23:08 codecov[bot]

    PR Description updated to latest commit (https://github.com/Significant-Gravitas/AutoGPT/commit/eaa95ea123822a020220baa593a52aa1a50fb8fd)

    qodo-merge-pro[bot] avatar Aug 05 '24 01:08 qodo-merge-pro[bot]

    PR Reviewer Guide 🔍

    ⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
    🧪 No relevant tests
    🔒 No security concerns identified
    ⚡ Key issues to review

    Consistency Check
    Ensure that the token costs and API capabilities for GPT4_O_MINI align with OpenAI's official specifications to maintain consistency across model implementations.

    qodo-merge-pro[bot] avatar Aug 05 '24 01:08 qodo-merge-pro[bot]

    PR Code Suggestions ✨

    CategorySuggestion                                                                                                                                    Score
    Maintainability
    Standardize the naming convention for model identifiers

    Consider using a consistent naming convention for the model identifiers. The new
    model identifier GPT4_O_MINI_v1 uses both uppercase and lowercase with an underscore
    and a hyphen, which is inconsistent with other model identifiers that use only
    uppercase and underscores.

    forge/forge/llm/providers/openai.py [79]

    -GPT4_O_MINI_v1 = "gpt-4o-mini-2024-07-18"
    +GPT4_O_MINI_V1 = "gpt-4o-mini-2024-07-18"
     
    
    • [ ] Apply this suggestion
    Suggestion importance[1-10]: 8

    Why: The suggestion improves code consistency and readability by standardizing the naming convention, which is important for maintainability.

    8

    qodo-merge-pro[bot] avatar Aug 05 '24 01:08 qodo-merge-pro[bot]

    PR Code Suggestions ✨

    Category Suggestion                                                                                                                                    Score Maintainability Standardize the naming convention for model identifiers Consider using a consistent naming convention for the model identifiers. The new model identifier GPT4_O_MINI_v1 uses both uppercase and lowercase with an underscore and a hyphen, which is inconsistent with other model identifiers that use only uppercase and underscores.

    forge/forge/llm/providers/openai.py [79]

    -GPT4_O_MINI_v1 = "gpt-4o-mini-2024-07-18"
    +GPT4_O_MINI_V1 = "gpt-4o-mini-2024-07-18"
     
    
    • [ ] Apply this suggestion

    Suggestion importance[1-10]: 8 8

    This suggestion isn't consistent with the casing of the other model names. They use lower case "v1" not "V1" as recommended.

    radleta avatar Aug 05 '24 02:08 radleta

    PR Code Suggestions ✨

    Category Suggestion                                                                                                                                    Score Maintainability Standardize the naming convention for model identifiers Consider using a consistent naming convention for the model identifiers. The new model identifier GPT4_O_MINI_v1 uses both uppercase and lowercase with an underscore and a hyphen, which is inconsistent with other model identifiers that use only uppercase and underscores. forge/forge/llm/providers/openai.py [79]

    -GPT4_O_MINI_v1 = "gpt-4o-mini-2024-07-18"
    +GPT4_O_MINI_V1 = "gpt-4o-mini-2024-07-18"
     
    
    • [ ] Apply this suggestion

    Suggestion importance[1-10]: 8 8

    This suggestion isn't consistent with the casing of the other model names. They use lower case "v1" not "V1" as recommended.

    No worries, not all of them are always applicable

    ntindle avatar Aug 05 '24 05:08 ntindle

    @Pwuts do you know anything about this chromedriver error?

    ntindle avatar Aug 06 '24 18:08 ntindle

    @ntindle looks like dark magic to me

    Pwuts avatar Aug 07 '24 23:08 Pwuts

    Hey @ntindle @Pwuts, I have created the PR to address this chromedriver issue along with the support for GPT-4o mini model. https://github.com/Significant-Gravitas/AutoGPT/pull/8007

    Thanks

    vishesh10 avatar Sep 06 '24 06:09 vishesh10

    superseeded by #8007

    ntindle avatar Sep 16 '24 19:09 ntindle