-
Notifications
You must be signed in to change notification settings - Fork 307
Feature/add gpt 4 1106 preview version #504
Feature/add gpt 4 1106 preview version #504
Conversation
WalkthroughThis update introduces a more efficient way of setting token limits based on the model type in Changes
Uplevel your code reviews with CodeRabbit ProCodeRabbit ProIf 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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 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.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Summary by CodeRabbit
TokenLimits
class, allowing users to utilize this new model with updated token limits and knowledge cutoff.TokenLimits
class by replacing the if-else chain with a switch statement, enhancing code readability and maintainability..gitignore
to exclude IDE-specific configuration files and other unnecessary files from the repository, ensuring cleaner commits and pull requests.