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

Support new GPT-3.5 Turbo model gpt-3.5-turbo-1106 #396

Merged
merged 2 commits into from
Nov 20, 2023

Conversation

onerinas
Copy link
Contributor

There is a new model gpt-3.5-turbo-1106 which replaces old GPT-3.5 Turbo models.

This PR adds the token limit for gpt-3.5-turbo-1106

https://platform.openai.com/docs/models/gpt-3-5

Currently we get the below error if we try to use this model:

lib/langchain/utils/token_length/base_validator.rb:22:in `validate_max_tokens!': undefined method `-' for nil:NilClass (NoMethodError)

          leftover_tokens = token_limit(model_name) - text_token_length```

There is a new model `gpt-3.5-turbo-1106` which replaces old GPT-3.5 Turbo models.

This PR adds the token limit for `gpt-3.5-turbo-1106` 

https://platform.openai.com/docs/models/gpt-3-5

Currently we get the below error if we try to use this model:
```
lib/langchain/utils/token_length/base_validator.rb:22:in `validate_max_tokens!': undefined method `-' for nil:NilClass (NoMethodError)

          leftover_tokens = token_limit(model_name) - text_token_length```
@onerinas
Copy link
Contributor Author

Seeing error while using the above:

max_tokens is too large: 15956. This model supports at most 4096 completion tokens, whereas you provided 15956.",

This make me think if it has a separate chat completion limit like we added recently for gpt-4 https://github.com/andreibondarev/langchainrb/pull/379/files#diff-b751390de4d557f12114162633bf3eedc62391b32e3e4145bf2a1b2f1df2f0afR13

@onerinas onerinas marked this pull request as draft November 20, 2023 13:58
@andreibondarev
Copy link
Collaborator

andreibondarev commented Nov 20, 2023

Seeing error while using the above:

max_tokens is too large: 15956. This model supports at most 4096 completion tokens, whereas you provided 15956.",

This make me think if it has a separate chat completion limit like we added recently for gpt-4 https://github.com/andreibondarev/langchainrb/pull/379/files#diff-b751390de4d557f12114162633bf3eedc62391b32e3e4145bf2a1b2f1df2f0afR13

That sounds correct:

GPT-3.5-Turbo-1106 has a max context window of 16,385 tokens and can generate 4,096 output tokens.

Source: https://learn.microsoft.com/en-us/azure/ai-services/openai/whats-new

@onerinas onerinas marked this pull request as ready for review November 20, 2023 16:20
@onerinas
Copy link
Contributor Author

@andreibondarev Thanks for the link, this seem to work. Let me know if there is anything else needed in this PR or if we can merge.

@andreibondarev andreibondarev merged commit 709fc58 into patterns-ai-core:main Nov 20, 2023
5 checks passed
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.

None yet

2 participants