Sqlite works, made fixes in config so it becomes a basis, added a few mods on top
This commit is contained in:
parent
b0b9c31102
commit
3a33503b24
3 changed files with 9 additions and 23 deletions
|
|
@ -28,7 +28,7 @@ class Config:
|
|||
|
||||
db_path = Path(__file__).resolve().parent / "database/data"
|
||||
|
||||
vectordb: str = "weaviate"
|
||||
vectordb: str = os.getenv("VECTORDB", "weaviate")
|
||||
db_type: str = os.getenv("DB_TYPE", "postgres")
|
||||
db_name: str = os.getenv("DB_NAME", "cognee.db")
|
||||
db_host: str = os.getenv("DB_HOST", "localhost")
|
||||
|
|
|
|||
|
|
@ -53,9 +53,9 @@ OPENAI_API_KEY = os.getenv("OPENAI_API_KEY", "")
|
|||
class VectorDBFactory:
|
||||
def __init__(self):
|
||||
self.db_map = {
|
||||
VectorDBType.PINECONE: PineconeVectorDB,
|
||||
VectorDBType.WEAVIATE: WeaviateVectorDB,
|
||||
VectorDBType.LANCEDB: LanceDB,
|
||||
VectorDBType.PINECONE.value: PineconeVectorDB,
|
||||
VectorDBType.WEAVIATE.value: WeaviateVectorDB,
|
||||
VectorDBType.LANCEDB.value: LanceDB,
|
||||
# Add more database types and their corresponding classes here
|
||||
}
|
||||
|
||||
|
|
@ -68,6 +68,8 @@ class VectorDBFactory:
|
|||
namespace: str = None,
|
||||
embeddings=None,
|
||||
):
|
||||
logging.info(f"db_type: {db_type}")
|
||||
logging.info(f"embeddings: {self.db_map}")
|
||||
if db_type in self.db_map:
|
||||
return self.db_map[db_type](
|
||||
user_id, index_name, memory_id, namespace, embeddings
|
||||
|
|
|
|||
|
|
@ -1,34 +1,18 @@
|
|||
import logging
|
||||
|
||||
from sqlalchemy.future import select
|
||||
|
||||
logging.basicConfig(level=logging.INFO)
|
||||
|
||||
import os
|
||||
|
||||
print(os.getcwd())
|
||||
|
||||
|
||||
from cognitive_architecture.database.relationaldb.models.user import User
|
||||
from cognitive_architecture.database.relationaldb.models.memory import MemoryModel
|
||||
|
||||
import ast
|
||||
import tracemalloc
|
||||
from cognitive_architecture.database.relationaldb.database_crud import add_entity
|
||||
|
||||
tracemalloc.start()
|
||||
|
||||
import os
|
||||
from dotenv import load_dotenv
|
||||
import uuid
|
||||
|
||||
load_dotenv()
|
||||
|
||||
|
||||
from cognitive_architecture.database.vectordb.basevectordb import BaseMemory
|
||||
|
||||
from cognitive_architecture.config import Config
|
||||
|
||||
load_dotenv()
|
||||
config = Config()
|
||||
config.load()
|
||||
|
||||
|
|
@ -41,7 +25,7 @@ class DynamicBaseMemory(BaseMemory):
|
|||
memory_id: str,
|
||||
index_name: str,
|
||||
db_type: str,
|
||||
namespace: str,
|
||||
namespace: str=None,
|
||||
embeddings=None,
|
||||
):
|
||||
super().__init__(user_id, memory_id, index_name, db_type, namespace, embeddings)
|
||||
|
|
@ -137,7 +121,7 @@ class Memory:
|
|||
user_id: str = "676",
|
||||
session=None,
|
||||
index_name: str = None,
|
||||
db_type: str = None,
|
||||
db_type: str = config.vectordb,
|
||||
namespace: str = None,
|
||||
memory_id: str = None,
|
||||
memory_class=None,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue