openai / automated-interpretability

977 stars 116 forks source link

explain_puzzles.ipynb - You didn't provide an API key #6

Open BenWare144 opened 1 year ago

BenWare144 commented 1 year ago

When I try to run explain_puzzles.ipynb, It is telling me I didn't provide an API key. But I the api key is already set in the os.environ["OPENAI_API_KEY"] from having added the API key to both ~/.zshrc and ~/.bash_profile as suggested here: https://help.openai.com/en/articles/5112595-best-practices-for-api-key-safety And I have tried removing the key from those files and manually setting it in the notebook as suggested, and the error persists.

Output:

puzzle_name='colors'
{'error': {'message': 'The model: `gpt-4` does not exist', 'type': 'invalid_request_error', 'param': None, 'code': 'model_not_found'}}

and this error:

HTTPStatusError: Client error '404 Not Found' for url 'https://api.openai.com/v1/chat/completions'
For more information check: https://httpstatuses.com/404

That url displays the following error:

"You didn't provide an API key. You need to provide your API key in an Authorization header using Bearer auth (i.e. Authorization: Bearer YOUR_KEY), or as the password field (with blank username) if you're accessing the API from your browser and are prompted for a username and password. You can obtain an API key from https://platform.openai.com/account/api-keys."

I am getting this error whether I run the notebook with jupyter labs or jupyter notebook.

BenWare144 commented 1 year ago

I think it might be because I don't have free access to gpt-4. When I use EXPLAINER_MODEL_NAME = "gpt-3.5-turbo" instead, it correctly generate 3 explanations, and then correctly throws an error to indicate the rate limit.

{'error': {'message': 'Rate limit reached for default-gpt-3.5-turbo in organization <my_org_id> on requests per min. Limit: 3 / min. Please try again in 20s. Contact us through our help center at help.openai.com if you continue to have issues. Please add a payment method to your account to increase your rate limit. Visit https://platform.openai.com/account/billing to add a payment method.', 'type': 'requests', 'param': None, 'code': None}}