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

Add support for GPT-4-32K and GPT-4-32K-0314 models #158

Merged
merged 1 commit into from
Mar 16, 2023

Conversation

aeieli
Copy link
Contributor

@aeieli aeieli commented Mar 15, 2023

This PR adds support for the GPT-4-32K and GPT-4-32K-0314 models by adding three new constants to the list of GPT models and adding the new models to the switch statements in the CreateChatCompletion and CreateCompletion functions. The PR also removes unnecessary code that checked for invalid models, as the new models are valid. The changes in this PR do not introduce any new issues and successfully add support for the new models.

Changes Made:

Added three new constants for GPT-4-32K and GPT-4-32K-0314 models
Added new models to switch statements in CreateChatCompletion and CreateCompletion functions
Removed unnecessary code that checked for invalid models

@codecov
Copy link

codecov bot commented Mar 15, 2023

Codecov Report

Merging #158 (505af4f) into master (f4a6a99) will increase coverage by 0.28%.
The diff coverage is 80.00%.

@@            Coverage Diff             @@
##           master     #158      +/-   ##
==========================================
+ Coverage   50.19%   50.48%   +0.28%     
==========================================
  Files          16       16              
  Lines         516      517       +1     
==========================================
+ Hits          259      261       +2     
  Misses        201      201              
+ Partials       56       55       -1     
Impacted Files Coverage Δ
completion.go 47.05% <50.00%> (+5.88%) ⬆️
chat.go 68.42% <100.00%> (+1.75%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@@ -97,7 +101,8 @@ func (c *Client) CreateCompletion(
ctx context.Context,
request CompletionRequest,
) (response CompletionResponse, err error) {
if request.Model == GPT3Dot5Turbo0301 || request.Model == GPT3Dot5Turbo {
switch request.Model {
case GPT3Dot5Turbo0301, GPT3Dot5Turbo, GPT4, GPT40314, GPT432K0314, GPT432K:
Copy link
Owner

Choose a reason for hiding this comment

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

Are we sure that GPT4 is not available for the CreateCompletion endpoint?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I am uncertain at this time as my account does not yet have the necessary permissions to use the new GPT-4 API

Copy link
Owner

Choose a reason for hiding this comment

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

Got it, thanks! I appreciate the effort to keep the API less brittle — let's wait a bit until we know these limitations for sure.

We can either keep this PR open or close it until next time.

@@ -68,7 +68,9 @@ func (c *Client) CreateChatCompletion(
request ChatCompletionRequest,
) (response ChatCompletionResponse, err error) {
model := request.Model
if model != GPT3Dot5Turbo0301 && model != GPT3Dot5Turbo {
switch model {
case GPT3Dot5Turbo0301, GPT3Dot5Turbo, GPT4, GPT40314, GPT432K0314, GPT432K:
Copy link
Owner

Choose a reason for hiding this comment

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

This check is useful though, let's remove the other switch and merge!

@sashabaranov sashabaranov changed the base branch from master to gpt4-dev March 16, 2023 06:32
@sashabaranov sashabaranov merged commit c6bc0f8 into sashabaranov:gpt4-dev Mar 16, 2023
sashabaranov added a commit that referenced this pull request Mar 16, 2023
* add chat gpt4 model support (#158)

* remove check for gpt4 for CreateCompletion

* test for model check

---------

Co-authored-by: aeieli <aeliieli@gmail.com>
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.

2 participants