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

The operation couldn’t be completed. (OpenAISwift.OpenAIError error 2.) #95

Closed
ChickenRei opened this issue Jul 4, 2023 · 3 comments

Comments

@ChickenRei
Copy link

No description provided.

@YamikoHikariX
Copy link

I get the same error. I use the sendChat command and supply an array of ChatMessages to it to provide the whole chat to GPT. It happens when there are lot of messages so I think the problem is when the tokens of all the provided ChatMessages exceeds the token limit of the model. In my case I use 3.5 turbo which has 4096 tokens. I coded it so that it counts each message's tokens using this encoder but even at 3500 tokens it gives this error. Maybe it's related to the amount of ChatMessages supplied?

Anyway, I tested it and at 93 messages which have 3183 tokens it replied. Above that it kept giving an error. That was just one test though

@adamrushy
Copy link
Owner

I believe this is related to the API and not the framework, feel free to provide more information though :]

@YamikoHikariX
Copy link

I think I found one of the causes of this error. I have several AI configurations in my app, each with different settings. In one of the configurations I accidentally set the topProbabilityMass to 9.0 instead of 0.9, which is outside of the allowed range for this value. So basically make sure all the values in the API call conform to the requirements of the API

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

No branches or pull requests

3 participants