Fix docs and config for vector store
This commit is contained in:
@@ -24,7 +24,7 @@ from mem0 import Memory
|
|||||||
|
|
||||||
|
|
||||||
config = {
|
config = {
|
||||||
"vectordb": {
|
"vector_store": {
|
||||||
"provider": "qdrant",
|
"provider": "qdrant",
|
||||||
"config": {
|
"config": {
|
||||||
"collection_name": "test",
|
"collection_name": "test",
|
||||||
@@ -50,7 +50,7 @@ from mem0 import Memory
|
|||||||
|
|
||||||
|
|
||||||
config = {
|
config = {
|
||||||
"vectordb": {
|
"vector_store": {
|
||||||
"provider": "chroma",
|
"provider": "chroma",
|
||||||
"config": {
|
"config": {
|
||||||
"collection_name": "test",
|
"collection_name": "test",
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ class ChromaDbConfig(BaseModel):
|
|||||||
client: Optional[Client] = Field(None, description="Existing ChromaDB client instance")
|
client: Optional[Client] = Field(None, description="Existing ChromaDB client instance")
|
||||||
path: Optional[str] = Field(None, description="Path to the database directory")
|
path: Optional[str] = Field(None, description="Path to the database directory")
|
||||||
host: Optional[str] = Field(None, description="Database connection remote host")
|
host: Optional[str] = Field(None, description="Database connection remote host")
|
||||||
port: Optional[str] = Field(None, description="Database connection remote port")
|
port: Optional[int] = Field(None, description="Database connection remote port")
|
||||||
|
|
||||||
@model_validator(mode="before")
|
@model_validator(mode="before")
|
||||||
def check_host_port_or_path(cls, values):
|
def check_host_port_or_path(cls, values):
|
||||||
|
|||||||
@@ -44,10 +44,6 @@ class Qdrant(VectorStoreBase):
|
|||||||
self.client = client
|
self.client = client
|
||||||
else:
|
else:
|
||||||
params = {}
|
params = {}
|
||||||
if path:
|
|
||||||
params["path"] = path
|
|
||||||
if os.path.exists(path) and os.path.isdir(path):
|
|
||||||
shutil.rmtree(path)
|
|
||||||
if api_key:
|
if api_key:
|
||||||
params["api_key"] = api_key
|
params["api_key"] = api_key
|
||||||
if url:
|
if url:
|
||||||
@@ -55,6 +51,12 @@ class Qdrant(VectorStoreBase):
|
|||||||
if host and port:
|
if host and port:
|
||||||
params["host"] = host
|
params["host"] = host
|
||||||
params["port"] = port
|
params["port"] = port
|
||||||
|
|
||||||
|
if not params:
|
||||||
|
params["path"] = path
|
||||||
|
if os.path.exists(path) and os.path.isdir(path):
|
||||||
|
shutil.rmtree(path)
|
||||||
|
|
||||||
self.client = QdrantClient(**params)
|
self.client = QdrantClient(**params)
|
||||||
|
|
||||||
self.create_col(collection_name, embedding_model_dims)
|
self.create_col(collection_name, embedding_model_dims)
|
||||||
|
|||||||
Reference in New Issue
Block a user