openai / chatgpt-retrieval-plugin

The ChatGPT Retrieval Plugin lets you easily find personal or work documents by asking questions in natural language.
MIT License
21.07k stars 3.69k forks source link

The readme doesn't say where to put the environment variables? #310

Closed wrharper-AASP closed 1 year ago

wrharper-AASP commented 1 year ago

Where? image

phaethonp commented 1 year ago

did you try the terminal?

wrharper-AASP commented 1 year ago

did you try the terminal?

I'm in windows so in the python script I put it after an os import as a workaround. The point is there is no direction on how to do this in the readme

MarkMarine commented 1 year ago

The environment variables get read by the retrieval plugin to access your openai key, database credentials, etc. So you want to set those environment variables in whatever context that you're starting the retrieval plugin with, so the program can access those. On unix machines, you'd just copy those environment variables into your terminal one by one, then execute the command to start the program (poetry run dev, or how ever you're starting it.) On windows, you can follow the instructions here: https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/set_1 and like the instructions say, instead of using the export name=value command you would use set name=value

That explained, I don't think a README for this program needs to contain detailed instructions for how to set environment variables in every conceivable OS, it would get crowded with minutia. You're expected to do a little research of your own. You could just ask chatGPT how to set environment variables in your chosen OS, or even write you a little script to automate the process so you don't need to type them in every time.

wrharper-AASP commented 1 year ago

Actually, I did it in the code and it should work on every OS. like this for example: os.environ["DATASTORE"] = "chroma" It should be possible to put it in one a .py file and just fill out the info and it should work regardless since import os takes care of that.

wrharper-AASP commented 1 year ago

This is also better because it still keeps the environment variables clean too.

MarkMarine commented 1 year ago

This is also better because it still keeps the environment variables clean too.

A good idea for your own personal project, but you wouldn't want to commit your database password accidentally to GitHub, so to help people avoid shooting themselves in the foot, I like the "type these environment variables into the shell" and further automation is left to the reader.

AASPLLC commented 1 year ago

that is handled too for me, but i see your point. it is authed in a secure way. no way for anyone to see it for me. os.environ['OPENAI_API_KEY'] = GetSecretKey(client)