Skip to content
This repository has been archived by the owner on Mar 6, 2024. It is now read-only.

Feature/add gpt 4 1106 preview version #504

Conversation

ms-omori
Copy link

@ms-omori ms-omori commented Dec 13, 2023

Summary by CodeRabbit

  • New Feature: Added support for the 'gpt-4-1106-preview' model in the TokenLimits class, allowing users to utilize this new model with updated token limits and knowledge cutoff.
  • Refactor: Improved the logic of setting properties in the TokenLimits class by replacing the if-else chain with a switch statement, enhancing code readability and maintainability.
  • Chore: Updated .gitignore to exclude IDE-specific configuration files and other unnecessary files from the repository, ensuring cleaner commits and pull requests.

Copy link
Contributor

github-actions bot commented Dec 13, 2023

Image description CodeRabbit

Walkthrough

This update introduces a more efficient way of setting token limits based on the model type in src/limits.ts and adds support for the 'gpt-4-1106-preview' model. It also improves project maintainability by ignoring IDE-specific and other unnecessary files via .gitignore.

Changes

File(s) Summary
.gitignore, .idea/.gitignore Added IDE-specific directories and other unnecessary files to be ignored by Git, improving project maintainability.
src/limits.ts Replaced if-else chain with a switch statement for setting token limits, enhancing code readability and efficiency. Added support for the 'gpt-4-1106-preview' model.

🐇💻

In the land where code rabbits dwell,

A new tale they've begun to tell.

With tokens aplenty, models galore,

They dance on keys, creating more.

Ignoring files, oh so neat,

Makes their burrow tidy and sweet.

Celebrate this change, for it's no small feat,

In the world of code, it's quite an elite! 🎉🥕


Uplevel your code reviews with CodeRabbit Pro

CodeRabbit Pro

If you like this project, please support us by purchasing the Pro version. The Pro version has advanced context, superior noise reduction and several proprietary improvements compared to the open source version. Moreover, CodeRabbit Pro is free for open source projects.

@ms-omori ms-omori closed this Dec 13, 2023
@ms-omori ms-omori deleted the feature/add-gpt-4-1106-preview-version branch December 13, 2023 02:40
Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Image description CodeRabbit

Commits Files that changed from the base of the PR and between d5ec397 and 74cfc67 commits.
Files selected (3)
  • .gitignore (1)
  • .idea/.gitignore (1)
  • src/limits.ts (1)
Files ignored due to filter (1)
  • dist/index.js
Files skipped from review due to trivial changes (2)
  • .gitignore
  • .idea/.gitignore
Review comments generated (1)
  • Review: 1
  • LGTM: 0

Tips

Chat with Image description CodeRabbit Bot (@coderabbitai)

  • Reply on review comments left by this bot to ask follow-up questions. A review comment is a comment on a diff or a file.
  • Invite the bot into a review comment chain by tagging @coderabbitai in a reply.

Code suggestions

  • The bot may make code suggestions, but please review them carefully before committing since the line number ranges may be misaligned.
  • You can edit the comment made by the bot and manually tweak the suggestion if it is slightly off.

Pausing incremental reviews

  • Add @coderabbitai: ignore anywhere in the PR description to pause further reviews from the bot.

Comment on lines +9 to +30
switch (model) {
case 'gpt-4-1106-preview':
this.maxTokens = 128000
this.responseTokens = 4000
this.knowledgeCutOff = '2023-04-01'
break
case 'gpt-4':
this.maxTokens = 8000
this.responseTokens = 2000
break
case 'gpt-4-32k':
this.maxTokens = 32600
this.responseTokens = 4000
break
case 'gpt-3.5-turbo-16k':
this.maxTokens = 16300
this.responseTokens = 3000
break
default:
this.maxTokens = 4000
this.responseTokens = 1000
break
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Image description CodeRabbit

The switch-case statement is a good improvement over the previous if-else chain for readability and maintainability. However, there's no error handling or notification when an unsupported model is passed to the constructor. It would be beneficial to throw an error in the default case when an unsupported model is provided.

      default:
        this.maxTokens = 4000
        this.responseTokens = 1000
+         throw new Error(`Unsupported model: ${model}`);
        break

This way, developers will be immediately aware when they are trying to use an unsupported model, rather than having it silently default to certain values.

@ms-omori ms-omori restored the feature/add-gpt-4-1106-preview-version branch December 13, 2023 02:44
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant