Add loggers for debugging (#1796)
This commit is contained in:
@@ -24,6 +24,8 @@ except ImportError:
|
||||
|
||||
from mem0.vector_stores.base import VectorStoreBase
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class OutputData(BaseModel):
|
||||
id: Optional[str] # memory id
|
||||
@@ -151,6 +153,7 @@ class ChromaDB(VectorStoreBase):
|
||||
payloads (Optional[List[Dict]], optional): List of payloads corresponding to vectors. Defaults to None.
|
||||
ids (Optional[List[str]], optional): List of IDs corresponding to vectors. Defaults to None.
|
||||
"""
|
||||
logger.info(f"Inserting {len(vectors)} vectors into collection {self.collection_name}")
|
||||
self.collection.add(ids=ids, embeddings=vectors, metadatas=payloads)
|
||||
|
||||
def search(
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import subprocess
|
||||
import sys
|
||||
import json
|
||||
import logging
|
||||
from typing import Optional, List
|
||||
from pydantic import BaseModel
|
||||
|
||||
@@ -24,6 +25,7 @@ except ImportError:
|
||||
|
||||
from mem0.vector_stores.base import VectorStoreBase
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
class OutputData(BaseModel):
|
||||
id: Optional[str]
|
||||
@@ -102,6 +104,7 @@ class PGVector(VectorStoreBase):
|
||||
payloads (List[Dict], optional): List of payloads corresponding to vectors.
|
||||
ids (List[str], optional): List of IDs corresponding to vectors.
|
||||
"""
|
||||
logger.info(f"Inserting {len(vectors)} vectors into collection {self.collection_name}")
|
||||
json_payloads = [json.dumps(payload) for payload in payloads]
|
||||
|
||||
data = [
|
||||
|
||||
@@ -16,6 +16,8 @@ from qdrant_client.models import (
|
||||
|
||||
from mem0.vector_stores.base import VectorStoreBase
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class Qdrant(VectorStoreBase):
|
||||
def __init__(
|
||||
@@ -102,6 +104,7 @@ class Qdrant(VectorStoreBase):
|
||||
payloads (list, optional): List of payloads corresponding to vectors. Defaults to None.
|
||||
ids (list, optional): List of IDs corresponding to vectors. Defaults to None.
|
||||
"""
|
||||
logger.info(f"Inserting {len(vectors)} vectors into collection {self.collection_name}")
|
||||
points = [
|
||||
PointStruct(
|
||||
id=idx if ids is None else ids[idx],
|
||||
|
||||
Reference in New Issue
Block a user