muellerberndt / mini-agi

MiniAGI is a simple general-purpose autonomous agent based on the OpenAI API.
MIT License
2.81k stars 292 forks source link

Doesn't recognize API key #44

Closed Philomelius closed 1 year ago

Philomelius commented 1 year ago

First of all, I do not have a GPT-4 key, I think those are special. I do have a GPT-3 key, though. So I changed the engine to gpt-3.5-turbo in .env.

But I get this message: openai.error.AuthenticationError: Incorrect API key provided

Thanks for the help. Here is my current .env file:

OPENAI_API_KEY=[nope]
MODEL="gpt-3.5-turbo"
SUMMARIZER_MODEL="gpt-3.5-turbo"

MAX_CONTEXT_SIZE=4000
MAX_MEMORY_ITEM_SIZE=2000
SUMMARIZER_CHUNK_SIZE=3000

CLEAR_DB_ON_START=true
WORK_DIR=
DEBUG=false
ChristianSch commented 1 year ago

If foobar-key is your key, it worked for me like this:

OPENAI_API_KEY="foobar-key"
MODEL="gpt-3.5-turbo"
SUMMARIZER_MODEL="gpt-3.5-turbo"

MAX_CONTEXT_SIZE=4000
MAX_MEMORY_ITEM_SIZE=2000
SUMMARIZER_CHUNK_SIZE=3000

CLEAR_DB_ON_START=true
WORK_DIR=
DEBUG=false

You should not include the [ or ] and " might also help with a flaky config reader.

Philomelius commented 1 year ago

Yup, that was it, thanks. API key must be in quotes. Readme should be clarified to reflect this.

ChristianSch commented 1 year ago

To clarify: I think it shouldn't be in brackets but quotes.

Philomelius commented 1 year ago

Yeah, sorry 'bout that. Edited.