anything-llm icon indicating copy to clipboard operation
anything-llm copied to clipboard

OpenAI API Key seems to not be read by AnythingLLM

Open pligor opened this issue 2 years ago • 2 comments
trafficstars

I tried to type the open ai key in the .env file with three different ways:

  1. OPEN_AI_KEY=xxxxxxxx
  2. OPEN_AI_KEY='xxxxxxxx'
  3. OPEN_AI_KEY="xxxxxxxx"

I do not think it makes a difference but every time we see this error in Anything LLM:

image and also cannot send prompts to anythingllm

Note that in addition ChromaDB server is up and running at localhost:8000 (pinecone and lancedb are disabled)

Any ideas of what is wrong ? How exactly to write the Open AI Api key in the .env file ?

pligor avatar Jun 22 '23 23:06 pligor

did you rebuild the docker after changing the environment variables? you should rebuild the docker and try again! hope it works.

Vikas94 avatar Jun 23 '23 16:06 Vikas94

The .env.example file erroneously has quotes around variable values which causes problems in cases like the Dockerfile groupadd command which uses GID='1000' interpreted without shell substitutions so groupadd fails saying "'1000' is no a valid GID (number)" and likewise, The OpenAI API key must be added to the .env file without quotes, that's no he only issue here, unfortunately. I seems there's an underlying parsing issue as well.

hillct avatar Jun 23 '23 17:06 hillct

@hillct Did you manage to get it resolved ? I saw here: https://github.com/Mintplex-Labs/anything-llm/issues/96 that you're having the same issue.

iguy0 avatar Jun 23 '23 21:06 iguy0

hi @vikas94 fyi I am in Macbook M2 Pro The README notes should mention that the full rebuild is with this: docker-compose down && docker-compose build --no-cache && docker-compose up -d And by removing all double or single quotes that where wrapping the values, things seems to be working ok now

However.. cannot create a new workspace. Now I have zero workspaces. see error message in this photo: image

And an example of my .env file can be seen below:

SERVER_PORT=3001
OPEN_AI_KEY=sk-AAAAAAAAAAAAAAAAAAAA
OPEN_MODEL_PREF=gpt-3.5-turbo
CACHE_VECTORS=true

# Enable all below if you are using vector database: Chroma.
VECTOR_DB=chroma
CHROMA_ENDPOINT=http://localhost:8000

# Enable all below if you are using vector database: Pinecone.
# VECTOR_DB=pinecone
# PINECONE_ENVIRONMENT=
# PINECONE_API_KEY=
# PINECONE_INDEX=

# Enable all below if you are using vector database: LanceDB.
# VECTOR_DB=lancedb

# CLOUD DEPLOYMENT VARIRABLES ONLY
# AUTH_TOKEN="hunter2" # This is the password to your application if remote hosting.
# JWT_SECRET="my-random-string-for-seeding" # Only needed if AUTH_TOKEN is set. Please generate random string at least 12 chars long.
# STORAGE_DIR="./server/storage"
# GOOGLE_APIS_KEY=
UID=1000
GID=1000

Could you help ? Cannot understand why is not working

pligor avatar Jun 23 '23 23:06 pligor