Each fix verified against mem0/vector_stores/ source and configs:
- baidu: table_name default mem0_table → mem0 (BaiduDBConfig)
- langchain: TS import mem0ai → mem0ai/oss; fix undefined LangchainVectorStore
variable to use MemoryVectorStore directly
- mongodb: collection_name default mem0_collection → mem0; mongo_uri default
corrected to mongodb://localhost:27017 (MongoDBConfig)
- neon: hnsw default False → True (PGVectorConfig.hnsw = True)
- neptune_analytics: extra name vector_stores → vector-stores (pyproject.toml)
- pgvector: diskann default True → False; hnsw default False → True
(PGVectorConfig)
- upstash-vector: move enable_embeddings inside config: {} block
(UpstashVectorConfig field, not top-level VectorStoreConfig)
- valkey: remove non-existent distance_metric row (not in ValkeyConfig);
fix extra name vector_stores → vector-stores
- vertex_ai: region is required (no default in GoogleMatchingEngineConfig)
- weaviate: install pip install weaviate weaviate-client → weaviate-client
(weaviate is not a separate package)
- overview: update TS supported vector DBs list to reflect actual
mem0-ts/src/oss/src/vector_stores/ files
77 lines
2.3 KiB
Plaintext
77 lines
2.3 KiB
Plaintext
---
|
|
title: "Upstash Vector"
|
|
description: "Use Upstash Vector as a serverless vector database in Mem0 with optional built-in embedding models."
|
|
---
|
|
[Upstash Vector](https://upstash.com/docs/vector) is a serverless vector database with built-in embedding models.
|
|
|
|
### Usage with Upstash embeddings
|
|
|
|
You can enable the built-in embedding models by setting `enable_embeddings` to `True`. This allows you to use Upstash's embedding models for vectorization.
|
|
|
|
```python
|
|
import os
|
|
from mem0 import Memory
|
|
|
|
os.environ["UPSTASH_VECTOR_REST_URL"] = "..."
|
|
os.environ["UPSTASH_VECTOR_REST_TOKEN"] = "..."
|
|
|
|
config = {
|
|
"vector_store": {
|
|
"provider": "upstash_vector",
|
|
"config": {
|
|
"enable_embeddings": True,
|
|
}
|
|
}
|
|
}
|
|
|
|
m = Memory.from_config(config)
|
|
m.add("Likes to play cricket on weekends", user_id="alice", metadata={"category": "hobbies"})
|
|
```
|
|
|
|
<Note>
|
|
Setting `enable_embeddings` to `True` will bypass any external embedding provider you have configured.
|
|
</Note>
|
|
|
|
### Usage with external embedding providers
|
|
|
|
```python
|
|
import os
|
|
from mem0 import Memory
|
|
|
|
os.environ["OPENAI_API_KEY"] = "..."
|
|
os.environ["UPSTASH_VECTOR_REST_URL"] = "..."
|
|
os.environ["UPSTASH_VECTOR_REST_TOKEN"] = "..."
|
|
|
|
config = {
|
|
"vector_store": {
|
|
"provider": "upstash_vector",
|
|
},
|
|
"embedder": {
|
|
"provider": "openai",
|
|
"config": {
|
|
"model": "text-embedding-3-large"
|
|
},
|
|
}
|
|
}
|
|
|
|
m = Memory.from_config(config)
|
|
m.add("Likes to play cricket on weekends", user_id="alice", metadata={"category": "hobbies"})
|
|
```
|
|
|
|
### Config
|
|
|
|
Here are the parameters available for configuring Upstash Vector:
|
|
|
|
| Parameter | Description | Default Value |
|
|
| ------------------- | ---------------------------------- | ------------- |
|
|
| `url` | URL for the Upstash Vector index | `None` |
|
|
| `token` | Token for the Upstash Vector index | `None` |
|
|
| `client` | An `upstash_vector.Index` instance | `None` |
|
|
| `collection_name` | The default namespace used | `""` |
|
|
| `enable_embeddings` | Whether to use Upstash embeddings | `False` |
|
|
|
|
<Note>
|
|
When `url` and `token` are not provided, the `UPSTASH_VECTOR_REST_URL` and
|
|
`UPSTASH_VECTOR_REST_TOKEN` environment variables are used.
|
|
</Note>
|