You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I installed jupyter, jupyterai and langchain-openai in a clean environment (using pixi). I entered my openAI api key and the chat window seems to work. however, using the %%ai magic in the notebook doesn't work
Reproduce
screenshot showing that the chat window works
screenshot showing that it knows about my openAI key:
error:
AuthenticationError: Error code: 401 - {'error': {'message': 'Incorrect API key provided: sk-QoS0U***************************************KCxR. You can find your API key at https://platform.openai.com/account/api-keys.', 'type': 'invalid_request_error', 'param': None, 'code': 'invalid_api_key'}}
@sg-s Jupyter AI magic commands can't read API keys from the chat settings in the UI. They only read from the set of environment variables. This is a known issue, and is due to a technical difficulty with passing data between the notebook kernel and the server.
What likely happened is that OPENAI_API_KEY was set to an outdated API key or an incomplete API key (e.g. perhaps you only copied the first 30 characters of the API key).
If you want to use both chat & magics simultaneously, we recommend setting the API key with both the environment variable OPENAI_API_KEY and through the chat settings for now.
This is definitely a usability issue that we should address in v3.0.0. I'll add it to our roadmap.
dlqqq
changed the title
Chat window works, but %%ai magic in notebook cell does not
Chat window works, but IPython magics do not
Nov 12, 2024
Description
I installed jupyter, jupyterai and langchain-openai in a clean environment (using pixi). I entered my openAI api key and the chat window seems to work. however, using the %%ai magic in the notebook doesn't work
Reproduce
screenshot showing that the chat window works
screenshot showing that it knows about my openAI key:
error:
AuthenticationError: Error code: 401 - {'error': {'message': 'Incorrect API key provided: sk-QoS0U***************************************KCxR. You can find your API key at https://platform.openai.com/account/api-keys.', 'type': 'invalid_request_error', 'param': None, 'code': 'invalid_api_key'}}
Expected behavior
it to not throw an authenticationerror
Context
jupyter = ">=1.1.1,<2"
jupyterlab = ">=4.2.5,<5"
jupyter-ai = ">=2.28.1,<3"
langchain-openai = ">=0.1.25,<0.2"
The text was updated successfully, but these errors were encountered: