From 986d32ca42671b1e092fa2842196463ac0992915 Mon Sep 17 00:00:00 2001 From: cs0lar Date: Fri, 7 Apr 2023 20:41:07 +0100 Subject: [PATCH 01/22] added support for multiple memory provider and added weaviate integration --- .env.template | 8 +- README.md | 26 ++++- requirements.txt | 1 + scripts/commands.py | 4 +- scripts/config.py | 8 ++ scripts/factory.py | 11 ++ scripts/main.py | 4 +- scripts/providers/__init__.py | 0 scripts/providers/memory.py | 26 +++++ scripts/{memory.py => providers/pinecone.py} | 18 +--- scripts/providers/weaviate.py | 100 +++++++++++++++++++ 11 files changed, 185 insertions(+), 21 deletions(-) create mode 100644 scripts/factory.py create mode 100644 scripts/providers/__init__.py create mode 100644 scripts/providers/memory.py rename scripts/{memory.py => providers/pinecone.py} (80%) create mode 100644 scripts/providers/weaviate.py diff --git a/.env.template b/.env.template index e9ccda5e..c9a45b2b 100644 --- a/.env.template +++ b/.env.template @@ -9,4 +9,10 @@ CUSTOM_SEARCH_ENGINE_ID= USE_AZURE=False OPENAI_API_BASE=your-base-url-for-azure OPENAI_API_VERSION=api-version-for-azure -OPENAI_DEPLOYMENT_ID=deployment-id-for-azure \ No newline at end of file +OPENAI_DEPLOYMENT_ID=deployment-id-for-azure +WEAVIATE_HOST="http://127.0.0.1" +WEAVIATE_PORT="8080" +WEAVIATE_USERNAME= +WEAVIATE_PASSWORD= +WEAVIATE_INDEX="Autogpt" +MEMORY_PROVIDER="weaviate" \ No newline at end of file diff --git a/README.md b/README.md index a89c5d03..9e8c24f2 100644 --- a/README.md +++ b/README.md @@ -140,7 +140,13 @@ export CUSTOM_SEARCH_ENGINE_ID="YOUR_CUSTOM_SEARCH_ENGINE_ID" ``` -## 🌲 Pinecone API Key Setup +## Vector based memory provider +Auto-GPT supports two providers for vector-based memory, [Pinecone](https://www.pinecone.io/) and [Weaviate](https://weaviate.io/). To select the provider to use, specify the following in your `.env`: + +``` +MEMORY_PROVIDER="pinecone" # change to "weaviate" to use weaviate as the memory provider +``` +### 🌲 Pinecone API Key Setup Pinecone enable a vector based memory so a vast memory can be stored and only relevant memories are loaded for the agent at any given time. @@ -149,7 +155,7 @@ are loaded for the agent at any given time. 2. Choose the `Starter` plan to avoid being charged. 3. Find your API key and region under the default project in the left sidebar. -### Setting up environment variables +#### Setting up environment variables For Windows Users: ``` setx PINECONE_API_KEY "YOUR_PINECONE_API_KEY" @@ -165,6 +171,22 @@ export PINECONE_ENV="Your pinecone region" # something like: us-east4-gcp Or you can set them in the `.env` file. +### 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). + +#### Setting up enviornment variables + +In your `.env` file set the following: + +``` +WEAVIATE_HOST="http://127.0.0.1" # the URL of the running Weaviate instance +WEAVIATE_PORT="8080" +WEAVIATE_USERNAME="your username" +WEAVIATE_PASSWORD="your password" +WEAVIATE_INDEX="Autogpt" # name of the index to create for the application +``` + ## View Memory Usage 1. View memory usage by using the `--debug` flag :) diff --git a/requirements.txt b/requirements.txt index ce247098..aed03226 100644 --- a/requirements.txt +++ b/requirements.txt @@ -12,3 +12,4 @@ docker duckduckgo-search google-api-python-client #(https://developers.google.com/custom-search/v1/overview) pinecone-client==2.2.1 +weaviate-client==3.15.4 diff --git a/scripts/commands.py b/scripts/commands.py index fc10d1d0..13037c34 100644 --- a/scripts/commands.py +++ b/scripts/commands.py @@ -1,6 +1,6 @@ import browse import json -from memory import PineconeMemory +from factory import MemoryFactory import datetime import agent_manager as agents import speak @@ -52,7 +52,7 @@ def get_command(response): def execute_command(command_name, arguments): - memory = PineconeMemory() + memory = MemoryFactory.get_memory(cfg.memory_provider) try: if command_name == "google": diff --git a/scripts/config.py b/scripts/config.py index fe48d298..bc88bbb9 100644 --- a/scripts/config.py +++ b/scripts/config.py @@ -50,9 +50,17 @@ class Config(metaclass=Singleton): self.google_api_key = os.getenv("GOOGLE_API_KEY") self.custom_search_engine_id = os.getenv("CUSTOM_SEARCH_ENGINE_ID") + self.memory_provider = os.getenv("MEMORY_PROVIDER", 'pinecone') self.pinecone_api_key = os.getenv("PINECONE_API_KEY") self.pinecone_region = os.getenv("PINECONE_ENV") + self.weaviate_host = os.getenv("WEAVIATE_HOST") + self.weaviate_port = os.getenv("WEAVIATE_PORT") + 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_index = os.getenv("WEAVIATE_INDEX", 'auto-gpt') + # User agent headers to use when browsing web # Some websites might just completely deny request with an error code if no user agent was found. self.user_agent_header = {"User-Agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.97 Safari/537.36"} diff --git a/scripts/factory.py b/scripts/factory.py new file mode 100644 index 00000000..44901631 --- /dev/null +++ b/scripts/factory.py @@ -0,0 +1,11 @@ +from providers.pinecone import PineconeMemory +from providers.weaviate import WeaviateMemory + +class MemoryFactory: + @staticmethod + def get_memory(mem_type): + if mem_type == 'pinecone': + return PineconeMemory() + + if mem_type == 'weaviate': + return WeaviateMemory() \ No newline at end of file diff --git a/scripts/main.py b/scripts/main.py index a79fd553..795c2ac4 100644 --- a/scripts/main.py +++ b/scripts/main.py @@ -1,7 +1,7 @@ import json import random import commands as cmd -from memory import PineconeMemory +from factory import MemoryFactory import data import chat from colorama import Fore, Style @@ -283,7 +283,7 @@ user_input = "Determine which next command to use, and respond using the format # Initialize memory and make sure it is empty. # this is particularly important for indexing and referencing pinecone memory -memory = PineconeMemory() +memory = MemoryFactory.get_memory(cfg.memory_provider) memory.clear() print('Using memory of type: ' + memory.__class__.__name__) diff --git a/scripts/providers/__init__.py b/scripts/providers/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/scripts/providers/memory.py b/scripts/providers/memory.py new file mode 100644 index 00000000..0440536e --- /dev/null +++ b/scripts/providers/memory.py @@ -0,0 +1,26 @@ +from config import Singleton +import openai + +def get_ada_embedding(text): + text = text.replace("\n", " ") + return openai.Embedding.create(input=[text], model="text-embedding-ada-002")["data"][0]["embedding"] + + +def get_text_from_embedding(embedding): + return openai.Embedding.retrieve(embedding, model="text-embedding-ada-002")["data"][0]["text"] + +class Memory(metaclass=Singleton): + def add(self, data): + raise NotImplementedError() + + def get(self, data): + raise NotImplementedError() + + def clear(self): + raise NotImplementedError() + + def get_relevant(self, data, num_relevant=5): + raise NotImplementedError() + + def get_stats(self): + raise NotImplementedError() \ No newline at end of file diff --git a/scripts/memory.py b/scripts/providers/pinecone.py similarity index 80% rename from scripts/memory.py rename to scripts/providers/pinecone.py index 0d265a31..971ef186 100644 --- a/scripts/memory.py +++ b/scripts/providers/pinecone.py @@ -1,20 +1,10 @@ -from config import Config, Singleton +from config import Config +from providers.memory import Memory, get_ada_embedding import pinecone -import openai cfg = Config() - -def get_ada_embedding(text): - text = text.replace("\n", " ") - return openai.Embedding.create(input=[text], model="text-embedding-ada-002")["data"][0]["embedding"] - - -def get_text_from_embedding(embedding): - return openai.Embedding.retrieve(embedding, model="text-embedding-ada-002")["data"][0]["text"] - - -class PineconeMemory(metaclass=Singleton): +class PineconeMemory(Memory): def __init__(self): pinecone_api_key = cfg.pinecone_api_key pinecone_region = cfg.pinecone_region @@ -58,4 +48,4 @@ class PineconeMemory(metaclass=Singleton): return [str(item['metadata']["raw_text"]) for item in sorted_results] def get_stats(self): - return self.index.describe_index_stats() + return self.index.describe_index_stats() \ No newline at end of file diff --git a/scripts/providers/weaviate.py b/scripts/providers/weaviate.py new file mode 100644 index 00000000..21718a03 --- /dev/null +++ b/scripts/providers/weaviate.py @@ -0,0 +1,100 @@ +from config import Config +from providers.memory import Memory, get_ada_embedding +from weaviate import Client +import weaviate +import uuid + +from weaviate.util import generate_uuid5 + +cfg = Config() + +SCHEMA = { + "class": cfg.weaviate_index, + "properties": [ + { + "name": "raw_text", + "dataType": ["text"], + "description": "original text for the embedding" + } + ], +} + +class WeaviateMemory(Memory): + + def __init__(self): + auth_credentials = self._build_auth_credentials() + + url = f'{cfg.weaviate_host}:{cfg.weaviate_port}' + + self.client = Client(url, auth_client_secret=auth_credentials) + + self._create_schema() + + def _create_schema(self): + if not self.client.schema.contains(SCHEMA): + self.client.schema.create_class(SCHEMA) + + @staticmethod + def _build_auth_credentials(): + if cfg.weaviate_username and cfg.weaviate_password: + return weaviate_auth.AuthClientPassword(cfg.weaviate_username, cfg.weaviate_password) + else: + return None + + def add(self, data): + vector = get_ada_embedding(data) + + doc_uuid = generate_uuid5(data, cfg.weaviate_index) + data_object = { + 'class': cfg.weaviate_index, + 'raw_text': data + } + + with self.client.batch as batch: + batch.add_data_object( + uuid=doc_uuid, + data_object=data_object, + class_name=cfg.weaviate_index, + vector=vector + ) + + batch.flush() + + return f"Inserting data into memory at uuid: {doc_uuid}:\n data: {data}" + + + def get(self, data): + return self.get_relevant(data, 1) + + + def clear(self): + self.client.schema.delete_all() + + # weaviate does not yet have a neat way to just remove the items in an index + # without removing the entire schema, therefore we need to re-create it + # after a call to delete_all + self._create_schema() + + return 'Obliterated' + + def get_relevant(self, data, num_relevant=5): + query_embedding = get_ada_embedding(data) + try: + results = self.client.query.get(cfg.weaviate_index, ['raw_text']) \ + .with_near_vector({'vector': query_embedding, 'certainty': 0.7}) \ + .with_limit(num_relevant) \ + .do() + + print(results) + + if len(results['data']['Get'][cfg.weaviate_index]) > 0: + return [str(item['raw_text']) for item in results['data']['Get'][cfg.weaviate_index]] + else: + return [] + + except Exception as err: + print(f'Unexpected error {err=}, {type(err)=}') + return [] + + def get_stats(self): + return self.client.index_stats.get(cfg.weaviate_index) \ No newline at end of file From da4ba3c10f66c43e0d211ada2a1277bf1b4ce713 Mon Sep 17 00:00:00 2001 From: cs0lar Date: Fri, 7 Apr 2023 22:07:08 +0100 Subject: [PATCH 02/22] added factory tests --- scripts/factory.py | 4 +++- tests/memory_tests.py | 55 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 58 insertions(+), 1 deletion(-) create mode 100644 tests/memory_tests.py diff --git a/scripts/factory.py b/scripts/factory.py index 44901631..19f67ba0 100644 --- a/scripts/factory.py +++ b/scripts/factory.py @@ -8,4 +8,6 @@ class MemoryFactory: return PineconeMemory() if mem_type == 'weaviate': - return WeaviateMemory() \ No newline at end of file + return WeaviateMemory() + + raise ValueError('Unknown memory provider') \ No newline at end of file diff --git a/tests/memory_tests.py b/tests/memory_tests.py new file mode 100644 index 00000000..4985c022 --- /dev/null +++ b/tests/memory_tests.py @@ -0,0 +1,55 @@ +import unittest +from unittest import mock +import sys +import os + +sys.path.append(os.path.abspath('./scripts')) + +from factory import MemoryFactory +from providers.weaviate import WeaviateMemory +from providers.pinecone import PineconeMemory + +class TestMemoryFactory(unittest.TestCase): + + def test_invalid_memory_provider(self): + + with self.assertRaises(ValueError): + memory = MemoryFactory.get_memory('Thanos') + + def test_create_pinecone_provider(self): + + # mock the init function of the provider to bypass + # connection to the external pinecone service + def __init__(self): + pass + + with mock.patch.object(PineconeMemory, '__init__', __init__): + memory = MemoryFactory.get_memory('pinecone') + self.assertIsInstance(memory, PineconeMemory) + + def test_create_weaviate_provider(self): + + # mock the init function of the provider to bypass + # connection to the external weaviate service + def __init__(self): + pass + + with mock.patch.object(WeaviateMemory, '__init__', __init__): + memory = MemoryFactory.get_memory('weaviate') + self.assertIsInstance(memory, WeaviateMemory) + + def test_provider_is_singleton(self): + + def __init__(self): + pass + + with mock.patch.object(WeaviateMemory, '__init__', __init__): + instance = MemoryFactory.get_memory('weaviate') + other_instance = MemoryFactory.get_memory('weaviate') + + self.assertIs(instance, other_instance) + + +if __name__ == '__main__': + unittest.main() + From 0ce0c553a60472cbffd42dc1650dc6a9bc0ff36e Mon Sep 17 00:00:00 2001 From: cs0lar Date: Sat, 8 Apr 2023 08:13:17 +0100 Subject: [PATCH 03/22] the three memory related commands memory_add, memory_del, memory_ovr are absent in the latest version of execute_command therefore the corresponding handlers commit_memory, delete_memory and overwrite_memory have been removed also because they assume a memory with a different interface than the proposed one. --- scripts/commands.py | 43 ------------------------------------------- 1 file changed, 43 deletions(-) diff --git a/scripts/commands.py b/scripts/commands.py index 13037c34..117f0e9d 100644 --- a/scripts/commands.py +++ b/scripts/commands.py @@ -182,49 +182,6 @@ def get_hyperlinks(url): return link_list -def commit_memory(string): - _text = f"""Committing memory with string "{string}" """ - mem.permanent_memory.append(string) - return _text - - -def delete_memory(key): - if key >= 0 and key < len(mem.permanent_memory): - _text = "Deleting memory with key " + str(key) - del mem.permanent_memory[key] - print(_text) - return _text - else: - print("Invalid key, cannot delete memory.") - return None - - -def overwrite_memory(key, string): - # Check if the key is a valid integer - if is_valid_int(key): - key_int = int(key) - # Check if the integer key is within the range of the permanent_memory list - if 0 <= key_int < len(mem.permanent_memory): - _text = "Overwriting memory with key " + str(key) + " and string " + string - # Overwrite the memory slot with the given integer key and string - mem.permanent_memory[key_int] = string - print(_text) - return _text - else: - print(f"Invalid key '{key}', out of range.") - return None - # Check if the key is a valid string - elif isinstance(key, str): - _text = "Overwriting memory with key " + key + " and string " + string - # Overwrite the memory slot with the given string key and string - mem.permanent_memory[key] = string - print(_text) - return _text - else: - print(f"Invalid key '{key}', must be an integer or a string.") - return None - - def shutdown(): print("Shutting down...") quit() From 76a1462e370297d3dab0d2b2c4ef4fa8739c9232 Mon Sep 17 00:00:00 2001 From: cs0lar Date: Sat, 8 Apr 2023 16:11:31 +0100 Subject: [PATCH 04/22] moved pinecone api config settings into provider class --- scripts/main.py | 2 -- scripts/providers/pinecone.py | 3 +++ 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/scripts/main.py b/scripts/main.py index 51495e20..4740c626 100644 --- a/scripts/main.py +++ b/scripts/main.py @@ -281,8 +281,6 @@ next_action_count = 0 # Make a constant: user_input = "Determine which next command to use, and respond using the format specified above:" -# raise an exception if pinecone_api_key or region is not provided -if not cfg.pinecone_api_key or not cfg.pinecone_region: raise Exception("Please provide pinecone_api_key and pinecone_region") # Initialize memory and make sure it is empty. # this is particularly important for indexing and referencing pinecone memory memory = MemoryFactory.get_memory(cfg.memory_provider) diff --git a/scripts/providers/pinecone.py b/scripts/providers/pinecone.py index 971ef186..e8cf019a 100644 --- a/scripts/providers/pinecone.py +++ b/scripts/providers/pinecone.py @@ -6,6 +6,9 @@ cfg = Config() class PineconeMemory(Memory): def __init__(self): + # raise an exception if pinecone_api_key or region is not provided + if not cfg.pinecone_api_key or not cfg.pinecone_region: raise Exception("Please provide pinecone_api_key and pinecone_region") + pinecone_api_key = cfg.pinecone_api_key pinecone_region = cfg.pinecone_region pinecone.init(api_key=pinecone_api_key, environment=pinecone_region) From 786ee6003c7716e747af32a67ffbaf10618f9784 Mon Sep 17 00:00:00 2001 From: cs0lar Date: Tue, 11 Apr 2023 13:50:02 +0100 Subject: [PATCH 05/22] fixed formatting --- README.md | 2 -- scripts/commands.py | 2 +- scripts/memory/pinecone.py | 2 +- scripts/memory/weaviate.py | 2 +- 4 files changed, 3 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 3e415361..18809f58 100644 --- a/README.md +++ b/README.md @@ -185,7 +185,6 @@ Pinecone enables the storage of vast amounts of vector-based memory, allowing fo 2. Choose the `Starter` plan to avoid being charged. 3. Find your API key and region under the default project in the left sidebar. - ### Setting up environment variables Simply set them in the `.env` file. @@ -193,7 +192,6 @@ Simply set them in the `.env` file. Alternatively, you can set them from the command line (advanced): For Windows Users: - ``` setx PINECONE_API_KEY "YOUR_PINECONE_API_KEY" setx PINECONE_ENV "Your pinecone region" # something like: us-east4-gcp diff --git a/scripts/commands.py b/scripts/commands.py index 5415c1e0..ce5d04ff 100644 --- a/scripts/commands.py +++ b/scripts/commands.py @@ -298,4 +298,4 @@ def delete_agent(key): result = agents.delete_agent(key) if not result: return f"Agent {key} does not exist." - return f"Agent {key} deleted." \ No newline at end of file + return f"Agent {key} deleted." diff --git a/scripts/memory/pinecone.py b/scripts/memory/pinecone.py index 287bc1dc..d89daf25 100644 --- a/scripts/memory/pinecone.py +++ b/scripts/memory/pinecone.py @@ -47,4 +47,4 @@ class PineconeMemory(MemoryProviderSingleton): return [str(item['metadata']["raw_text"]) for item in sorted_results] def get_stats(self): - return self.index.describe_index_stats() \ No newline at end of file + return self.index.describe_index_stats() diff --git a/scripts/memory/weaviate.py b/scripts/memory/weaviate.py index b6032648..d29192ea 100644 --- a/scripts/memory/weaviate.py +++ b/scripts/memory/weaviate.py @@ -97,4 +97,4 @@ class WeaviateMemory(MemoryProviderSingleton): .do() class_data = result['data']['Aggregate'][self.index] - return class_data[0]['meta'] if class_data else {} \ No newline at end of file + return class_data[0]['meta'] if class_data else {} From 3c7767fab07d8a1479fc04a7b3dd09d516fe01a9 Mon Sep 17 00:00:00 2001 From: cs0lar Date: Tue, 11 Apr 2023 13:51:31 +0100 Subject: [PATCH 06/22] fixed formatting --- scripts/main.py | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/main.py b/scripts/main.py index 21746118..8661bfad 100644 --- a/scripts/main.py +++ b/scripts/main.py @@ -415,3 +415,4 @@ while True: chat.create_chat_message( "system", "Unable to execute command")) print_to_console("SYSTEM: ", Fore.YELLOW, "Unable to execute command") + From 96c5e929be81e05954a1f3dcb25a03fc8dede91c Mon Sep 17 00:00:00 2001 From: cs0lar Date: Wed, 12 Apr 2023 05:40:24 +0100 Subject: [PATCH 07/22] added support for weaviate embedded --- .env.template | 4 +++- scripts/config.py | 2 ++ scripts/memory/weaviate.py | 14 ++++++++++++-- 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/.env.template b/.env.template index bc3bea20..9e4a1a9f 100644 --- a/.env.template +++ b/.env.template @@ -11,7 +11,9 @@ OPENAI_API_BASE=your-base-url-for-azure OPENAI_API_VERSION=api-version-for-azure OPENAI_DEPLOYMENT_ID=deployment-id-for-azure WEAVIATE_HOST="http://127.0.0.1" -WEAVIATE_PORT="8080" +WEAVIATE_PORT=8080 +USE_WEAVIATE_EMBEDDED=False +WEAVIATE_EMBEDDED_PATH="~/.local/share/weaviate" WEAVIATE_USERNAME= WEAVIATE_PASSWORD= IMAGE_PROVIDER=dalle diff --git a/scripts/config.py b/scripts/config.py index 2a0c0a94..7608a504 100644 --- a/scripts/config.py +++ b/scripts/config.py @@ -69,6 +69,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.use_weaviate_embedded = os.getenv("USE_WEAVIATE_EMBEDDED", False) self.image_provider = os.getenv("IMAGE_PROVIDER") self.huggingface_api_token = os.getenv("HUGGINGFACE_API_TOKEN") diff --git a/scripts/memory/weaviate.py b/scripts/memory/weaviate.py index d29192ea..10a76640 100644 --- a/scripts/memory/weaviate.py +++ b/scripts/memory/weaviate.py @@ -3,6 +3,7 @@ from memory.base import MemoryProviderSingleton, get_ada_embedding import uuid import weaviate from weaviate import Client +from weaviate.embedded import EmbeddedOptions from weaviate.util import generate_uuid5 def default_schema(weaviate_index): @@ -23,7 +24,17 @@ class WeaviateMemory(MemoryProviderSingleton): url = f'{cfg.weaviate_host}:{cfg.weaviate_port}' - self.client = Client(url, auth_client_secret=auth_credentials) + if cfg.use_weaviate_embedded: + self.client = Client(embedded_options=EmbeddedOptions( + hostname=cfg.weaviate_host, + port=int(cfg.weaviate_port), + persistence_data_path=cfg.weaviate_embedded_path + )) + + print(f"Weaviate Embedded running on: {url} with persistence path: {cfg.weaviate_embedded_path}") + else: + self.client = Client(url, auth_client_secret=auth_credentials) + self.index = cfg.memory_index self._create_schema() @@ -59,7 +70,6 @@ class WeaviateMemory(MemoryProviderSingleton): return f"Inserting data into memory at uuid: {doc_uuid}:\n data: {data}" - def get(self, data): return self.get_relevant(data, 1) From 453b428d33aa573608d76d8a64ef448e5070d77a Mon Sep 17 00:00:00 2001 From: cs0lar Date: Wed, 12 Apr 2023 08:21:41 +0100 Subject: [PATCH 08/22] added support for weaviate embedded --- .env.template | 5 +++-- requirements.txt | 2 +- scripts/config.py | 3 ++- scripts/memory/weaviate.py | 2 +- tests/test_weaviate_memory.py | 22 ++++++++++++++++++---- 5 files changed, 25 insertions(+), 9 deletions(-) diff --git a/.env.template b/.env.template index 9e4a1a9f..b9869fb9 100644 --- a/.env.template +++ b/.env.template @@ -10,10 +10,11 @@ USE_AZURE=False OPENAI_API_BASE=your-base-url-for-azure OPENAI_API_VERSION=api-version-for-azure OPENAI_DEPLOYMENT_ID=deployment-id-for-azure -WEAVIATE_HOST="http://127.0.0.1" +WEAVIATE_HOST="127.0.0.1" WEAVIATE_PORT=8080 +WEAVIATE_PROTOCOL="http" USE_WEAVIATE_EMBEDDED=False -WEAVIATE_EMBEDDED_PATH="~/.local/share/weaviate" +WEAVIATE_EMBEDDED_PATH="/home/me/.local/share/weaviate" WEAVIATE_USERNAME= WEAVIATE_PASSWORD= IMAGE_PROVIDER=dalle diff --git a/requirements.txt b/requirements.txt index 8004319d..d86ebe97 100644 --- a/requirements.txt +++ b/requirements.txt @@ -15,4 +15,4 @@ pinecone-client==2.2.1 redis orjson Pillow -weaviate-client==3.15.4 +weaviate-client==3.15.5 diff --git a/scripts/config.py b/scripts/config.py index 7608a504..ba43dca4 100644 --- a/scripts/config.py +++ b/scripts/config.py @@ -66,11 +66,12 @@ class Config(metaclass=Singleton): self.weaviate_host = os.getenv("WEAVIATE_HOST") self.weaviate_port = os.getenv("WEAVIATE_PORT") + self.weaviate_protocol = os.getenv("WEAVIATE_PROTOCOL", "http") 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.use_weaviate_embedded = os.getenv("USE_WEAVIATE_EMBEDDED", False) + self.use_weaviate_embedded = os.getenv("USE_WEAVIATE_EMBEDDED", "False") == "True" self.image_provider = os.getenv("IMAGE_PROVIDER") self.huggingface_api_token = os.getenv("HUGGINGFACE_API_TOKEN") diff --git a/scripts/memory/weaviate.py b/scripts/memory/weaviate.py index 10a76640..2eac5839 100644 --- a/scripts/memory/weaviate.py +++ b/scripts/memory/weaviate.py @@ -22,7 +22,7 @@ class WeaviateMemory(MemoryProviderSingleton): def __init__(self, cfg): auth_credentials = self._build_auth_credentials(cfg) - url = f'{cfg.weaviate_host}:{cfg.weaviate_port}' + url = f'{cfg.weaviate_protocol}://{cfg.weaviate_host}:{cfg.weaviate_port}' if cfg.use_weaviate_embedded: self.client = Client(embedded_options=EmbeddedOptions( diff --git a/tests/test_weaviate_memory.py b/tests/test_weaviate_memory.py index 41709bc0..6f39a203 100644 --- a/tests/test_weaviate_memory.py +++ b/tests/test_weaviate_memory.py @@ -13,10 +13,11 @@ from memory.weaviate import WeaviateMemory from memory.base import get_ada_embedding @mock.patch.dict(os.environ, { - "WEAVIATE_HOST": "http://127.0.0.1", + "WEAVIATE_HOST": "127.0.0.1", + "WEAVIATE_PROTOCOL": "http", "WEAVIATE_PORT": "8080", - "WEAVIATE_USERNAME": '', - "WEAVIATE_PASSWORD": '', + "WEAVIATE_USERNAME": "", + "WEAVIATE_PASSWORD": "", "MEMORY_INDEX": "AutogptTests" }) class TestWeaviateMemory(unittest.TestCase): @@ -24,11 +25,24 @@ class TestWeaviateMemory(unittest.TestCase): In order to run these tests you will need a local instance of Weaviate running. Refer to https://weaviate.io/developers/weaviate/installation/docker-compose for creating local instances using docker. + Alternatively in your .env file set the following environmental variables to run Weaviate embedded (see: https://weaviate.io/developers/weaviate/installation/embedded): + + USE_WEAVIATE_EMBEDDED=True + WEAVIATE_EMBEDDED_PATH="/home/me/.local/share/weaviate" """ def setUp(self): self.cfg = Config() - self.client = Client('http://127.0.0.1:8080') + if self.cfg.use_weaviate_embedded: + from weaviate.embedded import EmbeddedOptions + + self.client = Client(embedded_options=EmbeddedOptions( + hostname=self.cfg.weaviate_host, + port=int(self.cfg.weaviate_port), + persistence_data_path=self.cfg.weaviate_embedded_path + )) + else: + self.client = Client(f"{self.cfg.weaviate_protocol}://{self.cfg.weaviate_host}:{self.cfg.weaviate_port}") try: self.client.schema.delete_class(self.cfg.memory_index) From f2a6ac5dc203129a403e242d2516b71a385c90bc Mon Sep 17 00:00:00 2001 From: cs0lar Date: Wed, 12 Apr 2023 09:20:29 +0100 Subject: [PATCH 09/22] fixed order and removed dupes --- .env.template | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/.env.template b/.env.template index b9869fb9..602dc929 100644 --- a/.env.template +++ b/.env.template @@ -10,6 +10,9 @@ USE_AZURE=False OPENAI_API_BASE=your-base-url-for-azure OPENAI_API_VERSION=api-version-for-azure OPENAI_DEPLOYMENT_ID=deployment-id-for-azure +IMAGE_PROVIDER=dalle +HUGGINGFACE_API_TOKEN= +USE_MAC_OS_TTS=False WEAVIATE_HOST="127.0.0.1" WEAVIATE_PORT=8080 WEAVIATE_PROTOCOL="http" @@ -17,12 +20,5 @@ USE_WEAVIATE_EMBEDDED=False WEAVIATE_EMBEDDED_PATH="/home/me/.local/share/weaviate" WEAVIATE_USERNAME= WEAVIATE_PASSWORD= -IMAGE_PROVIDER=dalle -HUGGINGFACE_API_TOKEN= -OPENAI_AZURE_API_BASE=your-base-url-for-azure -OPENAI_AZURE_API_VERSION=api-version-for-azure -OPENAI_AZURE_DEPLOYMENT_ID=deployment-id-for-azure -IMAGE_PROVIDER=dalle -USE_MAC_OS_TTS=False MEMORY_INDEX="auto-gpt" MEMORY_BACKEND="local" From e3aea6d6c40119bdf7094a6e85691a2448a1abc3 Mon Sep 17 00:00:00 2001 From: cs0lar Date: Wed, 12 Apr 2023 17:21:37 +0100 Subject: [PATCH 10/22] added weaviate embedded section in README --- README.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 18809f58..9959f55d 100644 --- a/README.md +++ b/README.md @@ -207,6 +207,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`. #### Setting up enviornment variables @@ -214,10 +215,13 @@ In your `.env` file set the following: ``` MEMORY_BACKEND=weaviate -WEAVIATE_HOST="http://127.0.0.1" # the URL of the running Weaviate instance +WEAVIATE_HOST="127.0.0.1" # the IP or domain of the running Weaviate instance WEAVIATE_PORT="8080" +WEAVIATE_PROTOCOL="http" WEAVIATE_USERNAME="your username" WEAVIATE_PASSWORD="your password" +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 MEMORY_INDEX="Autogpt" # name of the index to create for the application ``` From 67b84b58115df6e2dfa52eb6c6a400c60b50eeda Mon Sep 17 00:00:00 2001 From: cs0lar Date: Wed, 12 Apr 2023 17:54:59 +0100 Subject: [PATCH 11/22] added client install --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 9959f55d..9f71ceaa 100644 --- a/README.md +++ b/README.md @@ -207,7 +207,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`. +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 enviornment variables From 415c1cb4b5212617777c0aca4dab07847d68747d Mon Sep 17 00:00:00 2001 From: cs0lar Date: Wed, 12 Apr 2023 18:55:34 +0100 Subject: [PATCH 12/22] fixed quotes --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index dd7547a2..3f5163f7 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 From 35ecd95c498708a00bf579053eb2f131c7721b83 Mon Sep 17 00:00:00 2001 From: cs0lar Date: Wed, 12 Apr 2023 18:56:42 +0100 Subject: [PATCH 13/22] removed unnecessary flush() --- scripts/memory/weaviate.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/scripts/memory/weaviate.py b/scripts/memory/weaviate.py index 2eac5839..e494a931 100644 --- a/scripts/memory/weaviate.py +++ b/scripts/memory/weaviate.py @@ -66,8 +66,6 @@ class WeaviateMemory(MemoryProviderSingleton): vector=vector ) - batch.flush() - return f"Inserting data into memory at uuid: {doc_uuid}:\n data: {data}" def get(self, data): From b7d0cc3b247cf80de031bc5e80232834d5f84111 Mon Sep 17 00:00:00 2001 From: cs0lar Date: Wed, 12 Apr 2023 19:00:30 +0100 Subject: [PATCH 14/22] removed the extra class property --- scripts/memory/weaviate.py | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/memory/weaviate.py b/scripts/memory/weaviate.py index e494a931..6de8be70 100644 --- a/scripts/memory/weaviate.py +++ b/scripts/memory/weaviate.py @@ -54,7 +54,6 @@ class WeaviateMemory(MemoryProviderSingleton): doc_uuid = generate_uuid5(data, self.index) data_object = { - 'class': self.index, 'raw_text': data } From 530894608b29cab2e0a4ac425894d4ca3f90398e Mon Sep 17 00:00:00 2001 From: cs0lar Date: Wed, 12 Apr 2023 19:09:52 +0100 Subject: [PATCH 15/22] added support of API key based auth --- .env.template | 1 + README.md | 3 ++- scripts/config.py | 3 ++- scripts/memory/weaviate.py | 2 ++ 4 files changed, 7 insertions(+), 2 deletions(-) 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 From 0c3562fcdd901bb399cf477564dfe814a80ff4bd Mon Sep 17 00:00:00 2001 From: cs0lar Date: Thu, 13 Apr 2023 18:50:56 +0100 Subject: [PATCH 16/22] fixed config bug --- scripts/memory/base.py | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/memory/base.py b/scripts/memory/base.py index 1d908531..1bb4e89f 100644 --- a/scripts/memory/base.py +++ b/scripts/memory/base.py @@ -3,6 +3,7 @@ import abc from config import AbstractSingleton, Config import openai +cfg = Config() def get_ada_embedding(text): text = text.replace("\n", " ") From 005be024f19dc0e95da8a339d5e1f5fec356dc64 Mon Sep 17 00:00:00 2001 From: cs0lar Date: Sat, 15 Apr 2023 14:45:16 +0100 Subject: [PATCH 17/22] fixed typo --- .env.template | 1 - 1 file changed, 1 deletion(-) diff --git a/.env.template b/.env.template index e6ef227f..f9d1ec10 100644 --- a/.env.template +++ b/.env.template @@ -57,7 +57,6 @@ SMART_TOKEN_LIMIT=8000 ################################################################################ # MEMORY_BACKEND - Memory backend type (Default: local) ->>>>>>> master MEMORY_BACKEND=local ### PINECONE From b2bfd395ed3f2c458eb88d81fbb6fbd353e55eed Mon Sep 17 00:00:00 2001 From: cs0lar Date: Sat, 15 Apr 2023 15:49:24 +0100 Subject: [PATCH 18/22] fixed formatting --- autogpt/memory/__init__.py | 3 ++- autogpt/memory/base.py | 1 + autogpt/memory/weaviate.py | 5 +++-- tests/integration/weaviate_memory_tests.py | 11 +++++------ 4 files changed, 11 insertions(+), 9 deletions(-) diff --git a/autogpt/memory/__init__.py b/autogpt/memory/__init__.py index d56b2de2..7b545ea3 100644 --- a/autogpt/memory/__init__.py +++ b/autogpt/memory/__init__.py @@ -27,6 +27,7 @@ except ImportError: print("Weaviate not installed. Skipping import.") WeaviateMemory = None + def get_memory(cfg, init=False): memory = None if cfg.memory_backend == "pinecone": @@ -53,7 +54,7 @@ def get_memory(cfg, init=False): " use Weaviate as a memory backend.") else: memory = WeaviateMemory(cfg) - + elif cfg.memory_backend == "no_memory": memory = NoMemory(cfg) diff --git a/autogpt/memory/base.py b/autogpt/memory/base.py index 784483fa..691e2299 100644 --- a/autogpt/memory/base.py +++ b/autogpt/memory/base.py @@ -7,6 +7,7 @@ from autogpt.config import AbstractSingleton, Config cfg = Config() + def get_ada_embedding(text): text = text.replace("\n", " ") if cfg.use_azure: diff --git a/autogpt/memory/weaviate.py b/autogpt/memory/weaviate.py index fdac8e85..48816973 100644 --- a/autogpt/memory/weaviate.py +++ b/autogpt/memory/weaviate.py @@ -6,6 +6,7 @@ from weaviate import Client from weaviate.embedded import EmbeddedOptions from weaviate.util import generate_uuid5 + def default_schema(weaviate_index): return { "class": weaviate_index, @@ -18,6 +19,7 @@ def default_schema(weaviate_index): ], } + class WeaviateMemory(MemoryProviderSingleton): def __init__(self, cfg): auth_credentials = self._build_auth_credentials(cfg) @@ -72,12 +74,11 @@ class WeaviateMemory(MemoryProviderSingleton): def get(self, data): return self.get_relevant(data, 1) - def clear(self): self.client.schema.delete_all() # weaviate does not yet have a neat way to just remove the items in an index - # without removing the entire schema, therefore we need to re-create it + # without removing the entire schema, therefore we need to re-create it # after a call to delete_all self._create_schema() diff --git a/tests/integration/weaviate_memory_tests.py b/tests/integration/weaviate_memory_tests.py index fa456c8a..503fe9d2 100644 --- a/tests/integration/weaviate_memory_tests.py +++ b/tests/integration/weaviate_memory_tests.py @@ -11,6 +11,7 @@ from autogpt.config import Config from autogpt.memory.weaviate import WeaviateMemory from autogpt.memory.base import get_ada_embedding + @mock.patch.dict(os.environ, { "WEAVIATE_HOST": "127.0.0.1", "WEAVIATE_PROTOCOL": "http", @@ -38,13 +39,13 @@ class TestWeaviateMemory(unittest.TestCase): )) else: cls.client = Client(f"{cls.cfg.weaviate_protocol}://{cls.cfg.weaviate_host}:{self.cfg.weaviate_port}") - + """ In order to run these tests you will need a local instance of Weaviate running. Refer to https://weaviate.io/developers/weaviate/installation/docker-compose for creating local instances using docker. Alternatively in your .env file set the following environmental variables to run Weaviate embedded (see: https://weaviate.io/developers/weaviate/installation/embedded): - + USE_WEAVIATE_EMBEDDED=True WEAVIATE_EMBEDDED_PATH="/home/me/.local/share/weaviate" """ @@ -53,7 +54,7 @@ class TestWeaviateMemory(unittest.TestCase): self.client.schema.delete_class(self.cfg.memory_index) except: pass - + self.memory = WeaviateMemory(self.cfg) def test_add(self): @@ -67,7 +68,7 @@ class TestWeaviateMemory(unittest.TestCase): def test_get(self): doc = 'You are an Avenger and swore to defend the Galaxy from a menace called Thanos' - + with self.client.batch as batch: batch.add_data_object( uuid=get_valid_uuid(uuid4()), @@ -83,7 +84,6 @@ class TestWeaviateMemory(unittest.TestCase): self.assertEqual(len(actual), 1) self.assertEqual(actual[0], doc) - def test_get_stats(self): docs = [ 'You are now about to count the number of docs in this index', @@ -98,7 +98,6 @@ class TestWeaviateMemory(unittest.TestCase): self.assertTrue('count' in stats) self.assertEqual(stats['count'], 2) - def test_clear(self): docs = [ 'Shame this is the last test for this class', From 8916b76f113aef3926fd57f938ae27a783e04192 Mon Sep 17 00:00:00 2001 From: cs0lar Date: Sat, 15 Apr 2023 18:52:59 +0100 Subject: [PATCH 19/22] fixed change request --- autogpt/memory/weaviate.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/autogpt/memory/weaviate.py b/autogpt/memory/weaviate.py index 48816973..3e112ca6 100644 --- a/autogpt/memory/weaviate.py +++ b/autogpt/memory/weaviate.py @@ -47,7 +47,7 @@ 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) + 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: From 899c815676178eef2c68f2ff3984474c25cc41f4 Mon Sep 17 00:00:00 2001 From: cs0lar Date: Sat, 15 Apr 2023 18:55:45 +0100 Subject: [PATCH 20/22] fixed auth code --- autogpt/memory/weaviate.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/autogpt/memory/weaviate.py b/autogpt/memory/weaviate.py index 3e112ca6..6fcce0a0 100644 --- a/autogpt/memory/weaviate.py +++ b/autogpt/memory/weaviate.py @@ -47,9 +47,9 @@ 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) + return weaviate.AuthClientPassword(cfg.weaviate_username, cfg.weaviate_password) if cfg.weaviate_api_key: - return weaviate.auth.AuthApiKey(api_key=cfg.weaviate_api_key) + return weaviate.AuthApiKey(api_key=cfg.weaviate_api_key) else: return None From 4cd412c39fb26cb6a3b4aa8e1de1646dfc800d39 Mon Sep 17 00:00:00 2001 From: BillSchumacher <34168009+BillSchumacher@users.noreply.github.com> Date: Sun, 16 Apr 2023 01:55:34 -0500 Subject: [PATCH 21/22] Update requirements.txt --- requirements.txt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/requirements.txt b/requirements.txt index 4abb8b43..1cdedec2 100644 --- a/requirements.txt +++ b/requirements.txt @@ -15,7 +15,6 @@ pinecone-client==2.2.1 redis orjson Pillow -weaviate-client==3.15.5 selenium webdriver-manager coverage @@ -28,4 +27,4 @@ isort gitpython==3.1.31 pytest pytest-mock -tweepy \ No newline at end of file +tweepy From b865e2c2f85893724210c34e1090f94bbae5e8e3 Mon Sep 17 00:00:00 2001 From: BillSchumacher <34168009+BillSchumacher@users.noreply.github.com> Date: Sun, 16 Apr 2023 02:08:38 -0500 Subject: [PATCH 22/22] Fix README --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 501429e0..00ada54f 100644 --- a/README.md +++ b/README.md @@ -59,6 +59,7 @@ Development of this free, open-source project is made possible by all the