jupyterlab / jupyter-ai

A generative AI extension for JupyterLab
https://jupyter-ai.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
3.25k stars 334 forks source link

Config UI should allow saving when API key is passed via an environment variable #1083

Open haesleinhuepf opened 3 weeks ago

haesleinhuepf commented 3 weeks ago

Description

I'm trying to use OpenAI GPT4 and struggle a bit with configuration. I'm using openai and have an environment variable configured. Hence, I do not need to configure my API key in Jupyter AI. It should work without.

Reproduce

The configuration dialog says the API key is optional, but there is an error message saying I must enter it.

image

Expected behavior

Make the API key optional, and remove the error message.

Context

dlqqq commented 3 weeks ago

@haesleinhuepf The error isn't being produced because "Base API URL" is empty, but rather the "OPENAI_API_KEY" text field listed under the "API Keys" section is empty.

Currently, the chat panel requires that the API key be provided under the "API Keys" section, even if the API key is already specified by an environment variable. If you copy the API key again and paste it into "OPENAI_API_KEY", you will be able to save your changes in the Config UI.

Although the workaround here is simple, this is a valid usability issue that should be addressed. Thank you for reporting this to our team! I've edited the title of this issue accordingly.

haesleinhuepf commented 3 weeks ago

I see. Sorry for my confusion.