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

If the API Key contains a newline, an incorrect error is thrown #82

Closed
carbone opened this issue Mar 22, 2023 · 3 comments
Closed

If the API Key contains a newline, an incorrect error is thrown #82

carbone opened this issue Mar 22, 2023 · 3 comments

Comments

@carbone
Copy link

carbone commented Mar 22, 2023

I am reading my API key from a file. My editor was adding a newline if the file was open. The result was that any call made via the client would error with the message "you must provide a model parameter", even though a model parameter was being sent.

I fixed my issue by simply trimming the result of my call to get the file's contents but the error message from the API was very confusing. Maybe just add the trim before sending to the API?

@ClaraLeigh
Copy link

This problem happens with any package when dealing with incorrect api keys so not really a bug but there could probably be a better error message.

This is probably an easy change so maybe open a PR to map the error to something more meaningful?

@gehrisandro
Copy link
Collaborator

@carbone

The error is provided by OpenAI so it's not possible to change the error on the library side.
But feel free to submit a PR which trims the API key automatically.

@gehrisandro
Copy link
Collaborator

closed: #101

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