θΏ™ζ˜―indexlocζδΎ›ηš„ζœεŠ‘οΌŒδΈθ¦θΎ“ε…₯任何密码
Skip to content

Conversation

@shatfield4
Copy link
Collaborator

Pull Request Type

  • ✨ feat
  • πŸ› fix
  • ♻️ refactor
  • πŸ’„ style
  • πŸ”¨ chore
  • πŸ“ docs

Relevant Issues

resolves #650

What is in this change?

Describe the changes in this PR that are impactful to the repo.

  • Add support for gpt-4-turbo-preview model in LLM selection for OpenAI

Additional Information

Add any other context about the Pull Request here that was not captured above.

Developer Validations

  • I ran yarn lint from the root of the repo & committed changes
  • Relevant documentation has been updated
  • I have tested my code functionality
  • Docker build succeeds locally

@review-agent-prime
Copy link

server/utils/AiProviders/openAi/index.js

Currently, the promptWindowLimit function uses a switch statement to determine the limit based on the model. This can be refactored to use a map or an object, which would be more efficient and easier to maintain. This would also allow for the limits to be defined in a single place, similar to the model names.
Create Issue
See the diff
Checkout the fix

    // Define the limits in a single file
    export const MODEL_LIMITS = {
      "gpt-3.5-turbo": 4096,
      "gpt-3.5-turbo-1106": 16385,
      "gpt-4": 8192,
      "gpt-4-1106-preview": 128000,
      "gpt-4-turbo-preview": 128000,
      "gpt-4-32k": 32000,
    };

    // Use the map in the function
    promptWindowLimit() {
      return MODEL_LIMITS[this.model] || 4096; // assume a fine-tune 3.5
    }
git fetch origin && git checkout -b ReviewBot/Refac-0ui4onj origin/ReviewBot/Refac-0ui4onj

@timothycarambat timothycarambat merged commit 21653b0 into master Jan 26, 2024
@timothycarambat timothycarambat deleted the 650-feat-add-support-for-gpt-4-turbo-preview-openai-model branch January 26, 2024 21:03
cabwds pushed a commit to cabwds/anything-llm that referenced this pull request Jul 3, 2025
* add gpt-4-turbo-preview

* add gpt-4-turbo-preview to valid models
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEAT] Add support for gpt-4-turbo-preview OpenAI model

3 participants