Skip to content

Commit

Permalink
pass in openai key
Browse files Browse the repository at this point in the history
  • Loading branch information
sarahwooders committed Apr 21, 2024
1 parent 7564dc6 commit d170a6e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions dev-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ services:
- MEMGPT_PG_PASSWORD=${MEMGPT_PG_PASSWORD}
- MEMGPT_PG_HOST=pgvector_db
- MEMGPT_PG_PORT=5432
- OPENAI_API_KEY=${OPENAI_API_KEY}
volumes:
- ./configs/server_config.yaml:/root/.memgpt/config # config file
- ~/.memgpt/credentials:/root/.memgpt/credentials # credentials file
8 changes: 8 additions & 0 deletions memgpt/server/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,14 @@ def __init__(
# TODO figure out how to handle credentials for the server
self.credentials = MemGPTCredentials.load()

# check credentials
# TODO: add checks for other providers
if (
self.config.default_embedding_config.embedding_endpoint_type == "openai"
or self.config.default_llm_config.model_endpoint_type == "openai"
):
assert self.credentials.openai_key is not None, "OpenAI key must be set in the credentials file"

# Ensure valid database configuration
# TODO: add back once tests are matched
# assert (
Expand Down

0 comments on commit d170a6e

Please sign in to comment.