The Memory Layer for AI Agents - Drop-in memory infrastructure for AI agents and apps. Context that persists. Built for production.
Python agentic-memoryagentic-memory-systemagentsaiai-agentschatgptgenaillmlong-term-memorymemorymemory-managementpythonragstate-management
feat: Add db_name field to MilvusDBConfig and MilvusDB initialization (#3229)
Vimpas7a0dc7391e6d
diff --git a/docs/components/vectordbs/dbs/milvus.mdx b/docs/components/vectordbs/dbs/milvus.mdxindex 4e93ba0ab..0e33f2766 100644--- a/docs/components/vectordbs/dbs/milvus.mdx+++ b/docs/components/vectordbs/dbs/milvus.mdx@@ -14,6 +14,7 @@ config = {"embedding_model_dims": "123","url": "127.0.0.1","token": "8e4b8ca8cf2c67",+ "db_name": "my_database",}}}@@ -39,3 +40,4 @@ Here's the parameters available for configuring Milvus Database:| `collection_name` | The name of the collection | `mem0` || `embedding_model_dims` | Dimensions of the embedding model | `1536` || `metric_type` | Metric type for similarity search | `L2` |+| `db_name` | Name of the database | `""` |diff --git a/docs/llms.txt b/docs/llms.txtindex 2cadb8b8b..9e8e61a4f 100644--- a/docs/llms.txt+++ b/docs/llms.txt@@ -110,7 +110,7 @@[Qdrant](https://docs.mem0.ai/components/vectordbs/dbs/qdrant): Integrate Qdrant vector database by configuring the Memory client with provider settings like collection_name, host, port, and other parameters - supports both local and remote deployments with options for persistent storage and custom client configurations.[Pinecone](https://docs.mem0.ai/components/vectordbs/dbs/pinecone): Integrate Pinecone's managed vector database by configuring the Memory client with serverless or pod deployment options, supporting high-performance vector search with customizable embedding dimensions, distance metrics, and cloud providers (AWS/GCP/Azure) - requires PINECONE_API_KEY and matching embedding model dimensions (e.g. 1536 for OpenAI).-[Milvus](https://docs.mem0.ai/components/vectordbs/dbs/milvus): Integrate Milvus open-source vector database by configuring the Memory client with provider settings like url (default localhost:19530), token (for Zilliz cloud), collection_name, embedding_model_dims (default 1536) and metric_type - supports both local and cloud deployments for AI applications of any scale.+[Milvus](https://docs.mem0.ai/components/vectordbs/dbs/milvus): Integrate Milvus open-source vector database by configuring the Memory client with provider settings like url (default localhost:19530), token (for Zilliz cloud), collection_name, embedding_model_dims (default 1536), metric_type and db_name (database name) - supports both local and cloud deployments for AI applications of any scale.[Weaviate](https://docs.mem0.ai/components/vectordbs/dbs/weaviate): Integrate Weaviate open-source vector search engine by configuring the Memory client with provider settings like collection_name (default: mem0), cluster_url, auth_client_secret and embedding_model_dims (default: 1536) - enables efficient storage and retrieval of high-dimensional vector embeddings.[Chroma](https://docs.mem0.ai/components/vectordbs/dbs/chroma): Integrate Chroma AI-native open-source vector database by configuring the Memory client with provider settings like collection_name (default: mem0), path (default: db), host, port, and client - enables simple storage and search of embeddings with focus on speed and ease of use.[Faiss](https://docs.mem0.ai/components/vectordbs/dbs/faiss): Integrate Faiss, a high-performance library for similarity search and clustering of dense vectors, by configuring the Memory client with settings like collection_name, path, and distance_strategy (euclidean/cosine/inner_product) - supports efficient local vector search with in-memory or persistent storage options and is optimized for large-scale production use.diff --git a/mem0/configs/vector_stores/milvus.py b/mem0/configs/vector_stores/milvus.pyindex 7578c6fce..4ad964457 100644--- a/mem0/configs/vector_stores/milvus.py+++ b/mem0/configs/vector_stores/milvus.py@@ -25,6 +25,7 @@ class MilvusDBConfig(BaseModel):collection_name: str = Field("mem0", description="Name of the collection")embedding_model_dims: int = Field(1536, description="Dimensions of the embedding model")metric_type: str = Field("L2", description="Metric type for similarity search")+ db_name: str = Field("", description="Name of the database")@model_validator(mode="before")@classmethoddiff --git a/mem0/vector_stores/milvus.py b/mem0/vector_stores/milvus.pyindex 656234e88..41c1a337f 100644--- a/mem0/vector_stores/milvus.py+++ b/mem0/vector_stores/milvus.py@@ -30,6 +30,7 @@ class MilvusDB(VectorStoreBase):collection_name: str,embedding_model_dims: int,metric_type: MetricType,+ db_name: str,) -> None:"""Initialize the MilvusDB database.@@ -39,11 +40,12 @@ class MilvusDB(VectorStoreBase):collection_name (str): Name of the collection (defaults to mem0).embedding_model_dims (int): Dimensions of the embedding model (defaults to 1536).metric_type (MetricType): Metric type for similarity search (defaults to L2).+ db_name (str): Name of the database (defaults to "")."""self.collection_name = collection_nameself.embedding_model_dims = embedding_model_dimsself.metric_type = metric_type- self.client = MilvusClient(uri=url, token=token)+ self.client = MilvusClient(uri=url, token=token, db_name=db_name)self.create_col(collection_name=self.collection_name,vector_size=self.embedding_model_dims,