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 | [Redis](https://redis.io/) is a scalable, real-time database that can store, search, and analyze vector data. |
| #2 | |
| #3 | ### Installation |
| #4 | ```bash |
| #5 | pip install redis redisvl |
| #6 | ``` |
| #7 | |
| #8 | Redis Stack using Docker: |
| #9 | ```bash |
| #10 | docker run -d --name redis-stack -p 6379:6379 -p 8001:8001 redis/redis-stack:latest |
| #11 | ``` |
| #12 | |
| #13 | ### Usage |
| #14 | |
| #15 | <CodeGroup> |
| #16 | ```python Python |
| #17 | import os |
| #18 | from mem0 import Memory |
| #19 | |
| #20 | os.environ["OPENAI_API_KEY"] = "sk-xx" |
| #21 | |
| #22 | config = { |
| #23 | "vector_store": { |
| #24 | "provider": "redis", |
| #25 | "config": { |
| #26 | "collection_name": "mem0", |
| #27 | "embedding_model_dims": 1536, |
| #28 | "redis_url": "redis://localhost:6379" |
| #29 | } |
| #30 | }, |
| #31 | "version": "v1.1" |
| #32 | } |
| #33 | |
| #34 | m = Memory.from_config(config) |
| #35 | messages = [ |
| #36 | {"role": "user", "content": "I'm planning to watch a movie tonight. Any recommendations?"}, |
| #37 | {"role": "assistant", "content": "How about thriller movies? They can be quite engaging."}, |
| #38 | {"role": "user", "content": "I’m not a big fan of thriller movies but I love sci-fi movies."}, |
| #39 | {"role": "assistant", "content": "Got it! I'll avoid thriller recommendations and suggest sci-fi movies in the future."} |
| #40 | ] |
| #41 | m.add(messages, user_id="alice", metadata={"category": "movies"}) |
| #42 | ``` |
| #43 | |
| #44 | ```typescript TypeScript |
| #45 | import { Memory } from 'mem0ai/oss'; |
| #46 | |
| #47 | const config = { |
| #48 | vectorStore: { |
| #49 | provider: 'redis', |
| #50 | config: { |
| #51 | collectionName: 'memories', |
| #52 | embeddingModelDims: 1536, |
| #53 | redisUrl: 'redis://localhost:6379', |
| #54 | username: 'your-redis-username', |
| #55 | password: 'your-redis-password', |
| #56 | }, |
| #57 | }, |
| #58 | }; |
| #59 | |
| #60 | const memory = new Memory(config); |
| #61 | const messages = [ |
| #62 | {"role": "user", "content": "I'm planning to watch a movie tonight. Any recommendations?"}, |
| #63 | {"role": "assistant", "content": "How about thriller movies? They can be quite engaging."}, |
| #64 | {"role": "user", "content": "I’m not a big fan of thriller movies but I love sci-fi movies."}, |
| #65 | {"role": "assistant", "content": "Got it! I'll avoid thriller recommendations and suggest sci-fi movies in the future."} |
| #66 | ] |
| #67 | await memory.add(messages, { userId: "alice", metadata: { category: "movies" } }); |
| #68 | ``` |
| #69 | </CodeGroup> |
| #70 | |
| #71 | ### Config |
| #72 | |
| #73 | Let's see the available parameters for the `redis` config: |
| #74 | |
| #75 | <Tabs> |
| #76 | <Tab title="Python"> |
| #77 | | Parameter | Description | Default Value | |
| #78 | | --- | --- | --- | |
| #79 | | `collection_name` | The name of the collection to store the vectors | `mem0` | |
| #80 | | `embedding_model_dims` | Dimensions of the embedding model | `1536` | |
| #81 | | `redis_url` | The URL of the Redis server | `None` | |
| #82 | </Tab> |
| #83 | <Tab title="TypeScript"> |
| #84 | | Parameter | Description | Default Value | |
| #85 | | --- | --- | --- | |
| #86 | | `collectionName` | The name of the collection to store the vectors | `mem0` | |
| #87 | | `embeddingModelDims` | Dimensions of the embedding model | `1536` | |
| #88 | | `redisUrl` | The URL of the Redis server | `None` | |
| #89 | | `username` | Username for Redis connection | `None` | |
| #90 | | `password` | Password for Redis connection | `None` | |
| #91 | </Tab> |
| #92 | </Tabs> |