Files
t6_mem0/docs/components/vectordb.mdx
2024-08-09 02:41:19 +05:30

76 lines
1.9 KiB
Plaintext

---
title: Supported Vector Databases
---
## Overview
Mem0 includes built-in support for various popular databases. Memory can utilize the database provided by the user, ensuring efficient use for specific needs.
<CardGroup>
<Card title="Qdrant" href="#qdrant"></Card>
<Card title="Chroma" href="#chroma"></Card>
</CardGroup>
## Qdrant
[Qdrant](https://qdrant.tech/) is an open-source vector search engine. It is designed to work with large-scale datasets and provides a high-performance search engine for vector data.
To use Qdrant you can do like this:
```python
import os
from mem0 import Memory
config = {
"vector_store": {
"provider": "qdrant",
"config": {
"collection_name": "test",
"host": "localhost",
"port": 6333,
}
}
}
m = Memory.from_config(config)
m.add("Likes to play cricket on weekends", user_id="alice", metadata={"category": "hobbies"})
```
## Chroma
[Chroma](https://www.trychroma.com/) is an AI-native open-source vector database that simplifies building LLM apps by providing tools for storing, embedding, and searching embeddings with a focus on simplicity and speed.
To use ChromaDB you can do like this:
```python
import os
from mem0 import Memory
config = {
"vector_store": {
"provider": "chroma",
"config": {
"collection_name": "test",
"path": "db",
}
}
}
m = Memory.from_config(config)
m.add("Likes to play cricket on weekends", user_id="alice", metadata={"category": "hobbies"})
```
## Common issues
### Using model with different dimensions
If you are using customized model, which is having different dimensions other than 1536
for example 768, you may encounter below error:
`ValueError: shapes (0,1536) and (768,) not aligned: 1536 (dim 1) != 768 (dim 0)`
you could add `"embedding_model_dims": 768,` to the config of the vector_store to overcome this issue.