Skip to content
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

Parametrized OpenAI Models #28813

Closed
3 tasks done
john-thomas-dotcms opened this issue Jun 8, 2024 · 0 comments · Fixed by #29236
Closed
3 tasks done

Parametrized OpenAI Models #28813

john-thomas-dotcms opened this issue Jun 8, 2024 · 0 comments · Fixed by #29236

Comments

@john-thomas-dotcms
Copy link
Contributor

john-thomas-dotcms commented Jun 8, 2024

Parent Issue

No response

User Story

Currently, the OpenAI models we support, and the parameters for those models (such as maximum tokens) are hard-coded in a Java file: https://github.com/dotCMS/core/blob/master/dotCMS/src/main/java/com/dotcms/ai/util/OpenAIModel.java

However, these models and parameters are not static. For example, OpenAI has added new models which are not in our list, and has already deprecated the gpt-3.5-turbo-16k model (and will decommission it completely in 3 months). But the only way we can change those for dotAI is with a Java code change (which will then also require backporting to 24.04 LTS).

We will have a more future-proof solution for this in dotAI phase 2. However, for now we need to:

  1. Not restrict the model name used in our code.
    • Users should be able to type in any model name they want, and we will pass it through to OpenAI.
    • But, we need to be able to detect in code if the OpenAI API returns an error indicating either that the model name is invalid, or that the model is no longer supported.
  2. Move all of the parameters specified in the Java code to configuration parameters in the dotAI App.
    • The code should then pull those parameters from the App.
    • Note that we will need 2 sets of parameters in the dotAI App - one for the text model and one for the image model.

Because of both our inability to support new OpenAI models, and the impending decommissioning of a model we support, this change is a high priority.

Acceptance Criteria

  1. Enable configuration of each of the following models and parameter sets via the dotAI App:
  2. When an error is returned from OpenAI indicating an invalid model name was entered, we capture it.
    • Although it would be ideal to differentiate between a model which doesn't exist vs. a model that's no longer supported, I'm not sure the OpenAI API will make that distinction, so this isn't required.
  3. When an error is returned from OpenAI indicating that the parameters are wrong (e.g. maximum tokens exceeded), we capture it.
  4. Any time we capture one of the above types of errors, we do all of the following:
    • Display a popup notification to the user attempting to use dotAI.
      • For the AI blocks, this notification can be displayed in the existing popups or in a separate error popup.
      • For other places where dotAI is used, we display the error in the standard way for that modality.
        • For example, if an error is generated with an API method, we return an error code but do not notify any users.
    • Display a Notification to the admin (in the Notifications pulldown; same permissions as reindex messages).
    • Write a message to the log (ERROR level).

Proposed Objective

Reliability

Proposed Priority

Priority 2 - Important

External Links... Slack Conversations, Support Tickets, Figma Designs, etc.

No response

Assumptions & Initiation Needs

No response

Quality Assurance Notes & Workarounds

No response

Sub-Tasks & Estimates

No response

Tasks

Preview Give feedback
  1. Priority : 2 High QA : Approved QA : Passed Internal Release : 24.08.20 Team : Falcon Type : New Functionality dotCMS : AI
    hmoreras victoralfaro-dotcms
  2. Priority : 2 High QA : Approved QA : Passed Internal Release : 24.09.21 Team : Falcon Type : New Functionality dotCMS : AI
  3. Priority : 2 High QA : Not Needed Release : 24.08.20 Team : Falcon Type : New Functionality dotCMS : AI
    victoralfaro-dotcms
@john-thomas-dotcms john-thomas-dotcms moved this from New to Next 1-3 Sprints in dotCMS - Product Planning Jun 8, 2024
@john-thomas-dotcms john-thomas-dotcms moved this from Next 1-3 Sprints to Current Sprint Backlog in dotCMS - Product Planning Jun 20, 2024
@victoralfaro-dotcms victoralfaro-dotcms self-assigned this Jul 15, 2024
@victoralfaro-dotcms victoralfaro-dotcms moved this from Current Sprint Backlog to In Progress in dotCMS - Product Planning Jul 15, 2024
victoralfaro-dotcms added a commit that referenced this issue Jul 16, 2024
@victoralfaro-dotcms victoralfaro-dotcms changed the title Move dotAI model parameters from Java code to dotAI App configuration Parametrized OpenAI Models Jul 18, 2024
victoralfaro-dotcms added a commit that referenced this issue Jul 29, 2024
victoralfaro-dotcms added a commit that referenced this issue Jul 30, 2024
@victoralfaro-dotcms victoralfaro-dotcms moved this from In Progress to In Review in dotCMS - Product Planning Jul 30, 2024
github-merge-queue bot pushed a commit that referenced this issue Jul 30, 2024
…29236)

Removing hardcoded OpenAI models at enum class OpenAIModel. Instead they
are now part of the `dotAI.yml` application descriptor so the user can
be the one who configures them not only one but multiple models for
`text`, `image` and `embeddings`.
The way to specify more than one is to provide a comma delimited list in
the new dotAI App params.
Sometimes we accept a model to use in the payload of our AI endpoints,
for this matter we will validate that model and if it's invalid we will
throw an exception.
When is not present in the payload, then our backend will inject the
current model.
Which leads us to the question: How will the current model be
determined?
This is part of the work defined for
#29284 (model fallback)
@dsilvam dsilvam moved this from In Review to In Progress in dotCMS - Product Planning Jul 31, 2024
@dsilvam dsilvam moved this from In Review to Done in dotCMS - Product Planning Sep 3, 2024
@dsilvam dsilvam closed this as completed Sep 3, 2024
@github-project-automation github-project-automation bot moved this from Done to Internal QA in dotCMS - Product Planning Sep 3, 2024
@dsilvam dsilvam moved this from Internal QA to Done in dotCMS - Product Planning Sep 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment