From 8df8c68853eb46bec1e5a60145b4e0cc2a954997 Mon Sep 17 00:00:00 2001 From: evelynmitchell Date: Sun, 28 Jan 2024 17:25:01 -0700 Subject: [PATCH] AbstractVectorDB, pinecone --- pyproject.toml | 1 + requirements.txt | 3 ++- swarms/memory/pinecone.py | 4 ++-- swarms/memory/sqlite.py | 4 ++-- swarms/memory/weaviate_db.py | 4 ++-- swarms/structs/agent.py | 4 ++-- 6 files changed, 11 insertions(+), 9 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 31b72863..31c7be39 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -74,6 +74,7 @@ ultralytics = "*" timm = "*" supervision = "*" scikit-image = "*" +pinecone-client = "*" diff --git a/requirements.txt b/requirements.txt index ab78bb36..1ef64bf7 100644 --- a/requirements.txt +++ b/requirements.txt @@ -62,4 +62,5 @@ peft psutil ultralytics supervision -scikit-image \ No newline at end of file +scikit-image +pinecone-client \ No newline at end of file diff --git a/swarms/memory/pinecone.py b/swarms/memory/pinecone.py index bf073d3e..b1c0edf3 100644 --- a/swarms/memory/pinecone.py +++ b/swarms/memory/pinecone.py @@ -1,12 +1,12 @@ from typing import Optional -from swarms.memory.base_vectordb import AbstractDatabase +from swarms.memory.base_vectordb import AbstractVectorDatabase import pinecone from attr import define, field from swarms.utils.hash import str_to_hash @define -class PineconeDB(AbstractDatabase): +class PineconeDB(AbstractVectorDatabase): """ PineconeDB is a vector storage driver that uses Pinecone as the underlying storage engine. diff --git a/swarms/memory/sqlite.py b/swarms/memory/sqlite.py index 2c4f2740..542be34b 100644 --- a/swarms/memory/sqlite.py +++ b/swarms/memory/sqlite.py @@ -1,5 +1,5 @@ from typing import List, Tuple, Any, Optional -from swarms.memory.base_vectordb import AbstractDatabase +from swarms.memory.base_vectordb import AbstractVectorDatabase try: import sqlite3 @@ -9,7 +9,7 @@ except ImportError: ) -class SQLiteDB(AbstractDatabase): +class SQLiteDB(AbstractVectorDatabase): """ A reusable class for SQLite database operations with methods for adding, deleting, updating, and querying data. diff --git a/swarms/memory/weaviate_db.py b/swarms/memory/weaviate_db.py index fec1199e..05ad5388 100644 --- a/swarms/memory/weaviate_db.py +++ b/swarms/memory/weaviate_db.py @@ -4,7 +4,7 @@ Weaviate API Client from typing import Any, Dict, List, Optional -from swarms.memory.base_vectordb import AbstractDatabase +from swarms.memory.base_vectordb import AbstractVectorDatabase try: import weaviate @@ -12,7 +12,7 @@ except ImportError: print("pip install weaviate-client") -class WeaviateDB(AbstractDatabase): +class WeaviateDB(AbstractVectorDatabase): """ Weaviate API Client diff --git a/swarms/structs/agent.py b/swarms/structs/agent.py index a5173482..61f0dd1e 100644 --- a/swarms/structs/agent.py +++ b/swarms/structs/agent.py @@ -83,7 +83,7 @@ class Agent: pdf_path (str): The path to the pdf list_of_pdf (str): The list of pdf tokenizer (Any): The tokenizer - memory (AbstractDatabase): The memory + memory (AbstractVectorDatabase): The memory preset_stopping_token (bool): Enable preset stopping token traceback (Any): The traceback traceback_handlers (Any): The traceback handlers @@ -168,7 +168,7 @@ class Agent: pdf_path: Optional[str] = None, list_of_pdf: Optional[str] = None, tokenizer: Optional[Any] = None, - long_term_memory: Optional[AbstractDatabase] = None, + long_term_memory: Optional[AbstractVectorDatabase] = None, preset_stopping_token: Optional[bool] = False, traceback: Any = None, traceback_handlers: Any = None,