repositories
loading repo index
repositories
loading repo index
repository
loading code, commits, and activity
public Clawd ADK gateway launch mirror
stars
latest
clone command
git clone gitlawb://did:key:z6Mkq5mY...iFZ5/my-project-publ...git clone gitlawb://did:key:z6Mkq5mY.../my-project-publ...2fa351d6docs: add automaton and perps launch sources16d ago| #1 | # Valkey Vector Store |
| #2 | |
| #3 | [Valkey](https://valkey.io/) is an open source (BSD) high-performance key/value datastore that supports a variety of workloads and rich datastructures including vector search. |
| #4 | |
| #5 | ## Installation |
| #6 | |
| #7 | ```bash |
| #8 | pip install mem0ai[vector_stores] |
| #9 | ``` |
| #10 | |
| #11 | ## Usage |
| #12 | |
| #13 | ```python |
| #14 | config = { |
| #15 | "vector_store": { |
| #16 | "provider": "valkey", |
| #17 | "config": { |
| #18 | "collection_name": "test", |
| #19 | "valkey_url": "valkey://localhost:6379", |
| #20 | "embedding_model_dims": 1536, |
| #21 | "index_type": "flat" |
| #22 | } |
| #23 | } |
| #24 | } |
| #25 | |
| #26 | m = Memory.from_config(config) |
| #27 | messages = [ |
| #28 | {"role": "user", "content": "I'm planning to watch a movie tonight. Any recommendations?"}, |
| #29 | {"role": "assistant", "content": "How about thriller movies? They can be quite engaging."}, |
| #30 | {"role": "user", "content": "I'm not a big fan of thriller movies but I love sci-fi movies."}, |
| #31 | {"role": "assistant", "content": "Got it! I'll avoid thriller recommendations and suggest sci-fi movies in the future."} |
| #32 | ] |
| #33 | m.add(messages, user_id="alice", metadata={"category": "movies"}) |
| #34 | ``` |
| #35 | |
| #36 | ## Parameters |
| #37 | |
| #38 | Here are the parameters available for configuring Valkey: |
| #39 | |
| #40 | | Parameter | Description | Default Value | |
| #41 | | --- | --- | --- | |
| #42 | | `collection_name` | The name of the collection to store the vectors | `mem0` | |
| #43 | | `valkey_url` | Connection URL for the Valkey server | `valkey://localhost:6379` | |
| #44 | | `embedding_model_dims` | Dimensions of the embedding model | `1536` | |
| #45 | | `index_type` | Vector index algorithm (`hnsw` or `flat`) | `hnsw` | |
| #46 | | `hnsw_m` | Number of bi-directional links for HNSW | `16` | |
| #47 | | `hnsw_ef_construction` | Size of dynamic candidate list for HNSW | `200` | |
| #48 | | `hnsw_ef_runtime` | Size of dynamic candidate list for search | `10` | |
| #49 | | `distance_metric` | Distance metric for vector similarity | `cosine` | |
| #50 |