royerlab / napari-chatgpt

A napari plugin to process and analyse images with chatGPT!
BSD 3-Clause "New" or "Revised" License
224 stars 24 forks source link

Problems setting up Napari ChatGPT #10

Closed LuisT1818 closed 5 months ago

LuisT1818 commented 1 year ago

Hi Loic,

we are trying to set up the Omega - Napari/ChatGPT in our GPU and we are in trouble.

We first open Conda

(base) C:\Users\IBMB-EMB-21>conda activate napari-chatgpt (napari-chatgpt) C:\Users\IBMB-EMB-21>napari

Napari opens fine

we call the plugin, open it and we get an error code calling for an API key

|-> No API key provided. You can set your API key in code using 'openai.api_key = ', or you can set the environment variable OPENAI_API_KEY=). If your API key is stored in a file, you can point the openai module at it with 'openai.api_key_path = '. You can generate API keys in the OpenAI web interface. See https://platform.openai.com/account/api-keys for details. NoneType: None

so, we created an API Key in openAI.com

The problem is that we do not know how to set the new API key in the code and we can not proceed further. if we keep clicking the omega plugin in napari we keep getting the same message in the command window

|-> No API key provided. You can set your API key in code using 'openai.api_key = ', or you can set the environment variable OPENAI_API_KEY=). If your API key is stored in a file, you can point the openai module at it with 'openai.api_key_path = '. You can generate API keys in the OpenAI web interface. See https://platform.openai.com/account/api-keys for details. NoneType: None

no new window for introducing the API key is shown in napari

What can we do? can you help?

royerloic commented 1 year ago

Dear Luis,

It is strange that you get an error; a window should open asking you to set the key. I will check the code now to ensure I did not introduce an error.

There are two ways by which you can set the OpenAI key:

1- Set the key as an environment variable; follow the instructions here: https://help.openai.com/en/articles/5112595-best-practices-for-api-key-safety

2- use Omega's built-in 'key vault' that automatically opens up a small popup window if the key is not set according to methods (1) above.

I hope this works! (methods 1 above must work and is a good approach if you trust the machine)

royerloic commented 1 year ago

Ok, I figured out the issue... I pushed an update, it should work now, a popup window should appear asking you to save the OpenAI API key in the 'vault' and secure it with an 'easy to remember' password.

royerloic commented 5 months ago

Closing this as I beleive this is fixed now.