diff --git a/.env.template b/.env.template index c8c33dd8..20736005 100644 --- a/.env.template +++ b/.env.template @@ -24,5 +24,6 @@ USE_WEAVIATE_EMBEDDED=False WEAVIATE_EMBEDDED_PATH="/home/me/.local/share/weaviate" WEAVIATE_USERNAME= WEAVIATE_PASSWORD= +WEAVIATE_API_KEY= MEMORY_INDEX="auto-gpt" MEMORY_BACKEND="local" diff --git a/README.md b/README.md index 3f5163f7..9b7753b4 100644 --- a/README.md +++ b/README.md @@ -226,7 +226,7 @@ export PINECONE_ENV="Your pinecone region" # something like: us-east4-gcp ## Weaviate Setup [Weaviate](https://weaviate.io/) is an open-source vector database. It allows to store data objects and vector embeddings from ML-models and scales seamlessly to billion of data objects. [An instance of Weaviate can be created locally (using Docker), on Kubernetes or using Weaviate Cloud Services](https://weaviate.io/developers/weaviate/quickstart). -Although still experimental, [Embedded Weaviate](https://weaviate.io/developers/weaviate/installation/embedded) is supported which allows the Auto-GPT process itself to start a Weaviate instance. To enable it, set `USE_WEAVIATE_EMBEDDED` to `True` and make sure you `pip install "weaviate-client>=3.15.4"`. +Although still experimental, [Embedded Weaviate](https://weaviate.io/developers/weaviate/installation/embedded) is supported which allows the Auto-GPT process itself to start a Weaviate instance. To enable it, set `USE_WEAVIATE_EMBEDDED` to `True` and make sure you `pip install "weaviate-client>=3.15.4"`. #### Setting up environment variables @@ -239,6 +239,7 @@ WEAVIATE_PORT="8080" WEAVIATE_PROTOCOL="http" WEAVIATE_USERNAME="your username" WEAVIATE_PASSWORD="your password" +WEAVIATE_API_KEY="your weaviate API key if you have one" WEAVIATE_EMBEDDED_PATH="/home/me/.local/share/weaviate" # this is optional and indicates where the data should be persisted when running an embedded instance USE_WEAVIATE_EMBEDDED=False # set to True to run Embedded Weaviate MEMORY_INDEX="Autogpt" # name of the index to create for the application diff --git a/scripts/config.py b/scripts/config.py index 2c08f762..065e37dd 100644 --- a/scripts/config.py +++ b/scripts/config.py @@ -74,7 +74,8 @@ class Config(metaclass=Singleton): self.weaviate_username = os.getenv("WEAVIATE_USERNAME", None) self.weaviate_password = os.getenv("WEAVIATE_PASSWORD", None) self.weaviate_scopes = os.getenv("WEAVIATE_SCOPES", None) - self.weaviate_embedded_path = os.getenv('WEAVIATE_EMBEDDED_PATH', '~/.local/share/weaviate') + self.weaviate_embedded_path = os.getenv("WEAVIATE_EMBEDDED_PATH", "~/.local/share/weaviate") + self.weaviate_api_key = os.getenv("WEAVIATE_API_KEY", None) self.use_weaviate_embedded = os.getenv("USE_WEAVIATE_EMBEDDED", "False") == "True" self.image_provider = os.getenv("IMAGE_PROVIDER") diff --git a/scripts/memory/weaviate.py b/scripts/memory/weaviate.py index 6de8be70..b5710cb5 100644 --- a/scripts/memory/weaviate.py +++ b/scripts/memory/weaviate.py @@ -46,6 +46,8 @@ class WeaviateMemory(MemoryProviderSingleton): def _build_auth_credentials(self, cfg): if cfg.weaviate_username and cfg.weaviate_password: return weaviate_auth.AuthClientPassword(cfg.weaviate_username, cfg.weaviate_password) + if cfg.weaviate_api_key: + return weaviate.auth.AuthApiKey(api_key=cfg.weaviate_api_key) else: return None