-
Notifications
You must be signed in to change notification settings - Fork 16
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
fix: Write an OpenAI-compatible error when context overflows #1031
Conversation
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.
There are a couple of cases where the value of stream
doesn't seem like it matches the example description.
const response = await postAuthorized(chatCompletion.url, { | ||
model: 'test-model', | ||
messages, | ||
stream: true, |
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.
stream
shouldn't be here, should it? The example says, "when not streaming".
{ content: 'How are you?', role: 'assistant' }, | ||
{ content: 'I am good, thank you!', role: 'user' }, | ||
]; | ||
const response = await postAuthorized(chatCompletion.url, { model: 'test-model', messages }); |
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.
And this one seems like it needs stream: true
?
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.
Yeah, it looks like I had named the test cases backwards. This is fixed now 👍
2ab7a44
to
2bc68bb
Compare
🎉 This PR is included in version 0.130.0 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
Previously the server would report an error stating
Message exceeds token limit.
.This error is now transformed into an OpenAI API compatible error, mimicking the same error returned by the official OpenAI API. This change allows Navie to properly reduce the token count before trying again.