Compare commits

..
61 Commits
Author SHA1 Message Date
5c67a5e6bc improvement(OSS): Fix AOSS and AWS BedRock LLM (#2697)
Co-authored-by: Prateek Chhikara <prateekchhikara24@gmail.com>
Co-authored-by: Deshraj Yadav <deshrajdry@gmail.com>
2025-05-16 04:49:29 +05:30
GongRzheandGitHub 267e5b13ea Update README.md (#2687) 2025-05-15 00:16:05 -07:00
a22287a3ba improvement(OpenMemory MCP): Improves Docker Compose commands (#2681)
Co-authored-by: Deshraj Yadav <deshrajdry@gmail.com>
2025-05-14 13:44:08 +05:30
Saket AryanandGitHub da59412150 Remove OpenMemory Directory from pyproject and Update Link (#2678) 2025-05-13 21:50:56 +05:30
Saket AryanandGitHub c41719ff9a Fix Backend Link in OpenMemory (#2677) 2025-05-13 08:36:59 -07:00
f51b39db91 Add OpenMemory (#2676)
Co-authored-by: Saket Aryan <94069182+whysosaket@users.noreply.github.com>
Co-authored-by: Saket Aryan <saketaryan2002@gmail.com>
2025-05-13 08:30:59 -07:00
Saket AryanandGitHub 8d61d73d2f Added ElizaOS Example (#2670) 2025-05-12 10:05:11 -07:00
Saket AryanandGitHub 10acf78618 Added Missing Param in AI SDK and Updated Demo Application (#2667) 2025-05-12 04:22:23 +05:30
Tomaz BratanicandGitHub caeae60dda Add weights to Neo4j model (#2657) 2025-05-10 14:51:34 -07:00
Dev KhantandGitHub d7b8497b24 Doc: update azure ai (#2661) 2025-05-09 20:03:34 +05:30
Dev KhantandGitHub a96e1d58f7 Support for AWS Bedrock Embeddings (#2660) 2025-05-09 19:44:35 +05:30
Tomaz BratanicandGitHub 0d895b28ae Improve neo4j queries (#2654) 2025-05-08 11:11:46 -07:00
Saket AryanandGitHub 84910b40da Added support for graceful failure in cases services are down. (#2650) 2025-05-08 16:03:26 +05:30
Prateek ChhikaraandGitHub 0e7c34f541 Renamed unknown node type (#2649) 2025-05-07 23:19:58 -07:00
Prateek ChhikaraandGitHub 2b58775c17 updated docs (#2647) 2025-05-07 14:09:48 -07:00
Dev KhantandGitHub 326f33757b Update Client (#2640) 2025-05-08 00:09:43 +05:30
Tomaz BratanicandGitHub c01221d4aa Add support for neo4j database (#2644) 2025-05-07 10:54:18 -07:00
Tomaz BratanicandGitHub 73d9ccac69 remove warnings and refresh schema from neo4j (#2643) 2025-05-07 10:16:39 -07:00
Wonbin KimandGitHub 5bbd0d9ca9 Fix duplicated metadata issue while adding or updating memories (#2592) 2025-05-07 21:10:32 +05:30
John LockwoodandGitHub 641be2878d Fix/new memories wrong type (#2635) 2025-05-07 17:35:24 +05:30
Prateek ChhikaraandGitHub eb7f5a774c Update Documentation: Clarify Dual-Identity Memory Management (#2642) 2025-05-06 23:08:32 -07:00
Saket AryanandGitHub 6e9f8cf218 Added New Param, output_format (#2639) 2025-05-06 22:56:48 +05:30
Dev KhantandGitHub 02a2b59555 Doc: update timestamp (#2638) 2025-05-06 17:39:31 +05:30
Dev KhantandGitHub ec1d7a45d3 Fix all lint errors (#2627) 2025-05-06 01:16:02 +05:30
Saket AryanandGitHub 725a1aa114 Updated deleteUsers to use V2 API Endpoints (#2624) 2025-05-05 23:23:13 +05:30
Dev KhantandGitHub d41f19b9ce Update delete_users() (#2623) 2025-05-05 23:21:06 +05:30
Saket AryanandGitHub a0fe9ca5b2 Fix AI SDK Filters (#2625) 2025-05-05 19:38:58 +05:30
Dev KhantandGitHub c81e2efbb0 Support for HF Inference (#2619) 2025-05-05 11:20:34 +05:30
Dev KhantandGitHub e9f5a882f5 Fix proxy for Mem0 (#2616) 2025-05-03 15:17:09 +05:30
Deshraj YadavandGitHub 7117a94fbf Remove unnecessary dependencies from base package (#2613) 2025-05-02 15:28:36 -07:00
Saket AryanandGitHub 63e22382de Updated TS client to use proper types for deleteUsers (#2612) 2025-05-02 23:11:40 +05:30
Prateek ChhikaraandGitHub 7b3abd06d0 Added dataset (#2611) 2025-05-02 10:19:58 -07:00
Prateek ChhikaraandGitHub e056acb6a8 docs change (#2606) 2025-05-01 14:03:04 -07:00
c09dfc3646 Vercel AI SDK / Graph Memory (#2601)
Co-authored-by: Deshraj Yadav <deshraj@gatech.edu>
2025-05-01 23:40:51 +05:30
Dev KhantandGitHub 6a1ece13dc Doc: Fix README links (#2602) 2025-05-01 22:00:56 +05:30
Dev KhantandGitHub b74cd9162f Doc: fix timestamp (#2599) 2025-05-01 16:54:47 +05:30
Saket AryanandGitHub 42c98e5717 Bumped Anthropic SDK Version (#2598) 2025-04-30 14:02:59 -07:00
Dev KhantandGitHub ad98f542f8 Fix mem0-migrations issue (#2597) 2025-05-01 01:14:57 +05:30
Saket AryanandGitHub 0fce700e65 Removed Grok3 Announcement (#2593) 2025-04-29 08:23:13 -07:00
Prateek ChhikaraandGitHub 393a4fd5a6 Docs Update (#2591) 2025-04-29 08:15:25 -07:00
Saket AryanandGitHub 6d13e83001 Fix Ping Method for using the default org_id and project_id (#2590) 2025-04-28 12:53:52 +05:30
Dev KhantandGitHub 1d916c9dd1 update changelog (#2588) 2025-04-26 16:40:56 +05:30
Dev KhantandGitHub 07ddd7cb4b version bump -> 0.1.94 (#2587) 2025-04-26 16:22:20 +05:30
darkhaniopandGitHub f412f8bb0d Doc: add "memory" in EC "Custom config" section and fix typos in the json config sample (#2574) 2025-04-25 19:51:33 +05:30
Dev KhantandGitHub 64c3d34deb Reset function for VectorDBs (#2584) 2025-04-25 00:01:53 +05:30
Dev KhantandGitHub ff6ae478f1 Doc: fix v2 search (#2583) 2025-04-23 18:11:36 +05:30
Saket AryanandGitHub cc5686bd0d Added Timestamp (#2579) 2025-04-23 12:29:27 +05:30
c958664185 Doc: Update timestamp and expiration_date (#2581)
Co-authored-by: Deshraj Yadav <deshrajdry@gmail.com>
2025-04-22 14:09:18 -07:00
Dev KhantandGitHub d43ca06992 Doc: add timestamp (#2580) 2025-04-23 01:05:16 +05:30
Katarina SupeandGitHub ba2e479902 Add Memgraph integration (#2537) 2025-04-22 16:27:24 +05:30
Dev KhantandGitHub cd5c3035ab version bump -> 0.1.93 (#2576) 2025-04-21 09:25:00 +05:30
Dev KhantandGitHub 09ac3618a8 Doc: fix agno link (#2573) 2025-04-19 10:59:50 +05:30
Dev KhantandGitHub 3ee4768c14 Init embedding_model_dims in all vectordbs (#2572) 2025-04-19 10:53:01 +05:30
Prateek ChhikaraandGitHub 78912928bc Changes to client (#2562) 2025-04-17 11:28:39 -07:00
Dev KhantandGitHub 8bd0d2dc24 Doc: fix curl for v2 get_all (#2567) 2025-04-17 23:10:54 +05:30
Saket AryanandGitHub f0bdd2c341 Add Support for Custom Instructions (#2565) 2025-04-17 14:38:07 +05:30
Antaripa SahaandGitHub bf0c4adc0c Fitness Checker powered by memory (#2561) 2025-04-16 08:37:23 -07:00
Dev KhantandGitHub 2cca50db80 Doc: update changelog (#2559) 2025-04-16 16:43:15 +05:30
Dev KhantandGitHub b8e4d0980a Memory Reset (#2558) 2025-04-16 16:36:45 +05:30
Dev KhantandGitHub 3613e2f14a Fix user_id functionality (#2548) 2025-04-16 13:32:33 +05:30
Dev KhantandGitHub 541030d69c Update capture_event (#2527) 2025-04-16 10:42:36 +05:30
378 changed files with 24255 additions and 1453 deletions
+8
View File
@@ -59,6 +59,10 @@ jobs:
- name: Install dependencies
run: make install_all
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
- name: Run Formatting
run: |
mkdir -p mem0/.ruff_cache && chmod -R 777 mem0/.ruff_cache
cd mem0 && poetry run ruff check . --select F
- name: Run tests and generate coverage report
run: make test
@@ -90,6 +94,10 @@ jobs:
- name: Install dependencies
run: cd embedchain && make install_all
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
- name: Run Formatting
run: |
mkdir -p embedchain/.ruff_cache && chmod -R 777 embedchain/.ruff_cache
cd embedchain && poetry run ruff check . --select F
- name: Lint with ruff
run: cd embedchain && make lint
- name: Run tests and generate coverage report
+2 -2
View File
@@ -12,9 +12,9 @@ install:
install_all:
poetry install
poetry run pip install groq together boto3 litellm ollama chromadb weaviate weaviate-client sentence_transformers vertexai \
poetry run pip install ruff==0.6.9 groq together boto3 litellm ollama chromadb weaviate weaviate-client sentence_transformers vertexai \
google-generativeai elasticsearch opensearch-py vecs pinecone pinecone-text faiss-cpu langchain-community \
upstash-vector azure-search-documents
upstash-vector azure-search-documents langchain-memgraph
# Format code with ruff
format:
+76 -96
View File
@@ -1,24 +1,22 @@
<p align="center">
<a href="https://github.com/mem0ai/mem0">
<img src="docs/images/banner-sm.png" width="800px" alt="Mem0 - The Memory Layer for Personalized AI">
<img src="docs/images/banner-sm.png" width="800px" alt="Mem0 - The Memory Layer for Personalized AI">
</a>
</p>
<p align="center" style="display: flex; justify-content: center; gap: 20px; align-items: center;">
<a href="https://trendshift.io/repositories/11194" target="_blank">
<img src="https://trendshift.io/api/badge/repositories/11194" alt="mem0ai%2Fmem0 | Trendshift" style="width: 250px; height: 55px;" width="250" height="55"/>
</a>
<a href="https://www.ycombinator.com/launches/LpA-mem0-open-source-memory-layer-for-ai-apps" target="_blank">
<img alt="Launch YC: Mem0 - Open Source Memory Layer for AI Apps" src="https://www.ycombinator.com/launches/LpA-mem0-open-source-memory-layer-for-ai-apps/upvote_embed.svg"/>
<a href="https://trendshift.io/repositories/11194" target="blank">
<img src="https://trendshift.io/api/badge/repositories/11194" alt="mem0ai%2Fmem0 | Trendshift" width="250" height="55"/>
</a>
</p>
<p align="center">
<a href="https://mem0.ai">Learn more</a>
·
<a href="https://mem0.dev/DiG">Join Discord</a>
·
<a href="https://mem0.dev/demo">Demo</a>
</p>
<p align="center">
<a href="https://mem0.ai">Learn more</a>
·
<a href="https://mem0.dev/DiG">Join Discord</a>
·
<a href="https://mem0.dev/demo">Demo</a>
·
<a href="https://mem0.dev/openmemory">OpenMemory</a>
</p>
<p align="center">
@@ -26,62 +24,78 @@
<img src="https://dcbadge.vercel.app/api/server/6PzXDgEjG5?style=flat" alt="Mem0 Discord">
</a>
<a href="https://pepy.tech/project/mem0ai">
<img src="https://img.shields.io/pypi/dm/mem0ai" alt="Mem0 PyPI - Downloads" >
<img src="https://img.shields.io/pypi/dm/mem0ai" alt="Mem0 PyPI - Downloads">
</a>
<a href="https://github.com/mem0ai/mem0">
<img src="https://img.shields.io/github/commit-activity/m/mem0ai/mem0?style=flat-square" alt="GitHub commit activity">
</a>
<a href="https://pypi.org/project/mem0ai" target="_blank">
<img src="https://img.shields.io/pypi/v/mem0ai?color=%2334D058&label=pypi%20package" alt="Package version">
</a>
<a href="https://www.npmjs.com/package/mem0ai" target="_blank">
<img src="https://img.shields.io/npm/v/mem0ai" alt="Npm package">
</a>
<a href="https://pypi.org/project/mem0ai" target="blank">
<img src="https://img.shields.io/pypi/v/mem0ai?color=%2334D058&label=pypi%20package" alt="Package version">
</a>
<a href="https://www.npmjs.com/package/mem0ai" target="blank">
<img src="https://img.shields.io/npm/v/mem0ai" alt="Npm package">
</a>
<a href="https://www.ycombinator.com/companies/mem0">
<img src="https://img.shields.io/badge/Y%20Combinator-S24-orange?style=flat-square" alt="Y Combinator S24">
</a>
</p>
<p align="center">
<a href="https://mem0.ai/research"><strong>📄 Building Production-Ready AI Agents with Scalable Long-Term Memory →</strong></a>
</p>
<p align="center">
<strong>⚡ +26% Accuracy vs. OpenAI Memory • 🚀 91% Faster • 💰 90% Fewer Tokens</strong>
</p>
## 🔥 Research Highlights
- **+26% Accuracy** over OpenAI Memory on the LOCOMO benchmark
- **91% Faster Responses** than full-context, ensuring low-latency at scale
- **90% Lower Token Usage** than full-context, cutting costs without compromise
- [Read the full paper](https://mem0.ai/research)
# Introduction
[Mem0](https://mem0.ai) (pronounced as "mem-zero") enhances AI assistants and agents with an intelligent memory layer, enabling personalized AI interactions. Mem0 remembers user preferences, adapts to individual needs, and continuously improves over time, making it ideal for customer support chatbots, AI assistants, and autonomous systems.
[Mem0](https://mem0.ai) ("mem-zero") enhances AI assistants and agents with an intelligent memory layer, enabling personalized AI interactions. It remembers user preferences, adapts to individual needs, and continuously learns over time—ideal for customer support chatbots, AI assistants, and autonomous systems.
### Features & Use Cases
### Key Features & Use Cases
Core Capabilities:
- **Multi-Level Memory**: User, Session, and AI Agent memory retention with adaptive personalization
- **Developer-Friendly**: Simple API integration, cross-platform consistency, and hassle-free managed service
**Core Capabilities:**
- **Multi-Level Memory**: Seamlessly retains User, Session, and Agent state with adaptive personalization
- **Developer-Friendly**: Intuitive API, cross-platform SDKs, and a fully managed service option
Applications:
- **AI Assistants**: Seamless conversations with context and personalization
- **Learning & Support**: Tailored content recommendations and context-aware customer assistance
- **Healthcare & Companions**: Patient history tracking and deeper relationship building
- **Productivity & Gaming**: Streamlined workflows and adaptive environments based on user behavior
**Applications:**
- **AI Assistants**: Consistent, context-rich conversations
- **Customer Support**: Recall past tickets and user history for tailored help
- **Healthcare**: Track patient preferences and history for personalized care
- **Productivity & Gaming**: Adaptive workflows and environments based on user behavior
## Get Started
## 🚀 Quickstart Guide <a name="quickstart"></a>
Get started quickly with [Mem0 Platform](https://app.mem0.ai) - our fully managed solution that provides automatic updates, advanced analytics, enterprise security, and dedicated support. [Create a free account](https://app.mem0.ai) to begin.
Choose between our hosted platform or self-hosted package:
For complete control, you can self-host Mem0 using our open-source package. See the [Quickstart guide](#quickstart) below to set up your own instance.
### Hosted Platform
## Quickstart Guide <a name="quickstart"></a>
Get up and running in minutes with automatic updates, analytics, and enterprise security.
Install the Mem0 package via pip:
1. Sign up on [Mem0 Platform](https://app.mem0.ai)
2. Embed the memory layer via SDK or API keys
### Self-Hosted (Open Source)
Install the sdk via pip:
```bash
pip install mem0ai
```
Install the Mem0 package via npm:
Install sdk via npm:
```bash
npm install mem0ai
```
### Basic Usage
Mem0 requires an LLM to function, with `gpt-4o-mini` from OpenAI as the default. However, it supports a variety of LLMs; for details, refer to our [Supported LLMs documentation](https://docs.mem0.ai/llms).
Mem0 requires an LLM to function, with `gpt-4o-mini` from OpenAI as the default. However, it supports a variety of LLMs; for details, refer to our [Supported LLMs documentation](https://docs.mem0.ai/components/llms/overview).
First step is to instantiate the memory:
@@ -96,7 +110,7 @@ def chat_with_memories(message: str, user_id: str = "default_user") -> str:
# Retrieve relevant memories
relevant_memories = memory.search(query=message, user_id=user_id, limit=3)
memories_str = "\n".join(f"- {entry['memory']}" for entry in relevant_memories["results"])
# Generate Assistant response
system_prompt = f"You are a helpful AI. Answer the question based on query and memories.\nUser Memories:\n{memories_str}"
messages = [{"role": "system", "content": system_prompt}, {"role": "user", "content": message}]
@@ -122,68 +136,34 @@ if __name__ == "__main__":
main()
```
See the example for [Node.js](https://docs.mem0.ai/examples/ai_companion_js).
For detailed integration steps, see the [Quickstart](https://docs.mem0.ai/quickstart) and [API Reference](https://docs.mem0.ai/api-reference).
For more advanced usage and API documentation, visit our [documentation](https://docs.mem0.ai).
## 🔗 Integrations & Demos
> [!TIP]
> For a hassle-free experience, try our [hosted platform](https://app.mem0.ai) with automatic updates and enterprise features.
- **ChatGPT with Memory**: Personalized chat powered by Mem0 ([Live Demo](https://mem0.dev/demo))
- **Browser Extension**: Store memories across ChatGPT, Perplexity, and Claude ([Chrome Extension](https://chromewebstore.google.com/detail/onihkkbipkfeijkadecaafbgagkhglop?utm_source=item-share-cb))
- **Langgraph Support**: Build a customer bot with Langgraph + Mem0 ([Guide](https://docs.mem0.ai/integrations/langgraph))
- **CrewAI Integration**: Tailor CrewAI outputs with Mem0 ([Example](https://docs.mem0.ai/integrations/crewai))
## Demos
## 📚 Documentation & Support
- Mem0 - ChatGPT with Memory: A personalized AI chat app powered by Mem0 that remembers your preferences, facts, and memories.
- Full docs: https://docs.mem0.ai
- Community: [Discord](https://mem0.dev/DiG) · [Twitter](https://x.com/mem0ai)
- Contact: founders@mem0.ai
[Mem0 - ChatGPT with Memory](https://github.com/user-attachments/assets/cebc4f8e-bdb9-4837-868d-13c5ab7bb433)
## Citation
Try live [demo](https://mem0.dev/demo/)
We now have a paper you can cite:
<br/><br/>
```bibtex
@article{mem0,
title={Mem0: Building Production-Ready AI Agents with Scalable Long-Term Memory},
author={Chhikara, Prateek and Khant, Dev and Aryan, Saket and Singh, Taranjeet and Yadav, Deshraj},
journal={arXiv preprint arXiv:2504.19413},
year={2025}
}
```
- AI Companion: Experience personalized conversations with an AI that remembers your preferences and past interactions
## ⚖️ License
[AI Companion Demo](https://github.com/user-attachments/assets/3fc72023-a72c-4593-8be0-3cee3ba744da)
<br/><br/>
- Enhance your AI interactions by storing memories across ChatGPT, Perplexity, and Claude using our browser extension. Get [chrome extension](https://chromewebstore.google.com/detail/mem0/onihkkbipkfeijkadecaafbgagkhglop?hl=en).
[Chrome Extension Demo](https://github.com/user-attachments/assets/ca92e40b-c453-4ff6-b25e-739fb18a8650)
<br/><br/>
- Customer support bot using <strong>Langgraph and Mem0</strong>. Get the complete code from [here](https://docs.mem0.ai/integrations/langgraph)
[Langgraph: Customer Bot](https://github.com/user-attachments/assets/ca6b482e-7f46-42c8-aa08-f88d1d93a5f4)
<br/><br/>
- Use Mem0 with CrewAI to get personalized results. Full example [here](https://docs.mem0.ai/integrations/crewai)
[CrewAI Demo](https://github.com/user-attachments/assets/69172a79-ccb9-4340-91f1-caa7d2dd4213)
## Documentation
For detailed usage instructions and API reference, visit our [documentation](https://docs.mem0.ai). You'll find:
- Complete API reference
- Integration guides
- Advanced configuration options
- Best practices and examples
- More details about:
- Open-source version
- [Hosted Mem0 Platform](https://app.mem0.ai)
## Support
Join our community for support and discussions. If you have any questions, feel free to reach out to us using one of the following methods:
- [Join our Discord](https://mem0.dev/DiG)
- [Follow us on Twitter](https://x.com/mem0ai)
- [Email founders](mailto:founders@mem0.ai)
## License
This project is licensed under the Apache 2.0 License - see the [LICENSE](LICENSE) file for details.
Apache 2.0 — see the [LICENSE](LICENSE) file for details.
+2
View File
@@ -7,10 +7,12 @@
# forked from autogen.agentchat.contrib.capabilities.teachability.Teachability
from typing import Dict, Optional, Union
from autogen.agentchat.assistant_agent import ConversableAgent
from autogen.agentchat.contrib.capabilities.agent_capability import AgentCapability
from autogen.agentchat.contrib.text_analyzer_agent import TextAnalyzerAgent
from termcolor import colored
from mem0 import Memory
+259 -259
View File
@@ -1,42 +1,116 @@
{
"cells": [
{
"metadata": {},
"cell_type": "code",
"execution_count": null,
"id": "1e8a980a2e0b9a85",
"metadata": {},
"outputs": [],
"source": [
"%pip install --upgrade pip\n",
"%pip install mem0ai pyautogen flaml"
],
"id": "1e8a980a2e0b9a85",
"outputs": [],
"execution_count": null
]
},
{
"cell_type": "code",
"execution_count": 11,
"id": "d437544fe259dd1b",
"metadata": {
"ExecuteTime": {
"end_time": "2024-09-25T20:29:52.443024Z",
"start_time": "2024-09-25T20:29:52.440046Z"
}
},
"cell_type": "code",
"outputs": [],
"source": [
"# Set up ENV Vars\n",
"import os\n",
"os.environ['OPENAI_API_KEY'] = \"sk-xxx\"\n"
],
"id": "d437544fe259dd1b",
"outputs": [],
"execution_count": 11
]
},
{
"cell_type": "code",
"execution_count": 12,
"id": "initial_id",
"metadata": {
"collapsed": true,
"ExecuteTime": {
"end_time": "2024-09-25T20:30:03.914245Z",
"start_time": "2024-09-25T20:29:53.236601Z"
}
},
"collapsed": true
},
"cell_type": "code",
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"WARNING:autogen.agentchat.contrib.gpt_assistant_agent:OpenAI client config of GPTAssistantAgent(assistant) - model: gpt-4o\n",
"WARNING:autogen.agentchat.contrib.gpt_assistant_agent:Matching assistant found, using the first matching assistant: {'id': 'asst_PpOJ2mJC8QeysR54I6DEdi4E', 'created_at': 1726444855, 'description': None, 'instructions': 'You are a helpful AI assistant.\\nSolve tasks using your coding and language skills.\\nIn the following cases, suggest python code (in a python coding block) or shell script (in a sh coding block) for the user to execute.\\n 1. When you need to collect info, use the code to output the info you need, for example, browse or search the web, download/read a file, print the content of a webpage or a file, get the current date/time, check the operating system. After sufficient info is printed and the task is ready to be solved based on your language skill, you can solve the task by yourself.\\n 2. When you need to perform some task with code, use the code to perform the task and output the result. Finish the task smartly.\\nSolve the task step by step if you need to. If a plan is not provided, explain your plan first. Be clear which step uses code, and which step uses your language skill.\\nWhen using code, you must indicate the script type in the code block. The user cannot provide any other feedback or perform any other action beyond executing the code you suggest. The user can\\'t modify your code. So do not suggest incomplete code which requires users to modify. Don\\'t use a code block if it\\'s not intended to be executed by the user.\\nIf you want the user to save the code in a file before executing it, put # filename: <filename> inside the code block as the first line. Don\\'t include multiple code blocks in one response. Do not ask users to copy and paste the result. Instead, use \\'print\\' function for the output when relevant. Check the execution result returned by the user.\\nIf the result indicates there is an error, fix the error and output the code again. Suggest the full code instead of partial code or code changes. If the error can\\'t be fixed or if the task is not solved even after the code is executed successfully, analyze the problem, revisit your assumption, collect additional info you need, and think of a different approach to try.\\nWhen you find an answer, verify the answer carefully. Include verifiable evidence in your response if possible.\\nReply \"TERMINATE\" in the end when everything is done.\\n ', 'metadata': {}, 'model': 'gpt-4o', 'name': 'assistant', 'object': 'assistant', 'tools': [], 'response_format': 'auto', 'temperature': 1.0, 'tool_resources': ToolResources(code_interpreter=None, file_search=None), 'top_p': 1.0}\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"\u001b[33muser_proxy\u001b[0m (to assistant):\n",
"\n",
"Write a Python function that reverses a string.\n",
"\n",
"--------------------------------------------------------------------------------\n",
"\u001b[33massistant\u001b[0m (to user_proxy):\n",
"\n",
"Sure! Here is the Python code for a function that takes a string as input and returns the reversed string.\n",
"\n",
"```python\n",
"def reverse_string(s):\n",
" return s[::-1]\n",
"\n",
"# Example usage\n",
"if __name__ == \"__main__\":\n",
" example_string = \"Hello, world!\"\n",
" reversed_string = reverse_string(example_string)\n",
" print(f\"Original string: {example_string}\")\n",
" print(f\"Reversed string: {reversed_string}\")\n",
"```\n",
"\n",
"When you run this code, it will print the original string and the reversed string. You can replace `example_string` with any string you want to reverse.\n",
"\n",
"\n",
"--------------------------------------------------------------------------------\n",
"\u001b[31m\n",
">>>>>>>> EXECUTING CODE BLOCK 0 (inferred language is python)...\u001b[0m\n",
"\u001b[33muser_proxy\u001b[0m (to assistant):\n",
"\n",
"exitcode: 0 (execution succeeded)\n",
"Code output: \n",
"Original string: Hello, world!\n",
"Reversed string: !dlrow ,olleH\n",
"\n",
"\n",
"--------------------------------------------------------------------------------\n",
"\u001b[33massistant\u001b[0m (to user_proxy):\n",
"\n",
"Great, the function worked as expected! The original string \"Hello, world!\" was correctly reversed to \"!dlrow ,olleH\".\n",
"\n",
"If you have any other tasks or need further assistance, let me know! \n",
"\n",
"TERMINATE\n",
"\n",
"\n",
"--------------------------------------------------------------------------------\n"
]
},
{
"data": {
"text/plain": [
"ChatResult(chat_id=None, chat_history=[{'content': 'Write a Python function that reverses a string.', 'role': 'assistant', 'name': 'user_proxy'}, {'content': 'Sure! Here is the Python code for a function that takes a string as input and returns the reversed string.\\n\\n```python\\ndef reverse_string(s):\\n return s[::-1]\\n\\n# Example usage\\nif __name__ == \"__main__\":\\n example_string = \"Hello, world!\"\\n reversed_string = reverse_string(example_string)\\n print(f\"Original string: {example_string}\")\\n print(f\"Reversed string: {reversed_string}\")\\n```\\n\\nWhen you run this code, it will print the original string and the reversed string. You can replace `example_string` with any string you want to reverse.\\n', 'role': 'user', 'name': 'assistant'}, {'content': 'exitcode: 0 (execution succeeded)\\nCode output: \\nOriginal string: Hello, world!\\nReversed string: !dlrow ,olleH\\n', 'role': 'assistant', 'name': 'user_proxy'}, {'content': 'Great, the function worked as expected! The original string \"Hello, world!\" was correctly reversed to \"!dlrow ,olleH\".\\n\\nIf you have any other tasks or need further assistance, let me know! \\n\\nTERMINATE\\n', 'role': 'user', 'name': 'assistant'}], summary='Great, the function worked as expected! The original string \"Hello, world!\" was correctly reversed to \"!dlrow ,olleH\".\\n\\nIf you have any other tasks or need further assistance, let me know! \\n\\n\\n', cost={'usage_including_cached_inference': {'total_cost': 0}, 'usage_excluding_cached_inference': {'total_cost': 0}}, human_input=[])"
]
},
"execution_count": 12,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# AutoGen GPTAssistantAgent Capabilities:\n",
"# - Generates code based on user requirements and preferences.\n",
@@ -93,90 +167,40 @@
"user_query = \"Write a Python function that reverses a string.\"\n",
"# Initiate Chat w/o Memory\n",
"user_proxy.initiate_chat(gpt_assistant, message=user_query)"
],
"id": "initial_id",
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"WARNING:autogen.agentchat.contrib.gpt_assistant_agent:OpenAI client config of GPTAssistantAgent(assistant) - model: gpt-4o\n",
"WARNING:autogen.agentchat.contrib.gpt_assistant_agent:Matching assistant found, using the first matching assistant: {'id': 'asst_PpOJ2mJC8QeysR54I6DEdi4E', 'created_at': 1726444855, 'description': None, 'instructions': 'You are a helpful AI assistant.\\nSolve tasks using your coding and language skills.\\nIn the following cases, suggest python code (in a python coding block) or shell script (in a sh coding block) for the user to execute.\\n 1. When you need to collect info, use the code to output the info you need, for example, browse or search the web, download/read a file, print the content of a webpage or a file, get the current date/time, check the operating system. After sufficient info is printed and the task is ready to be solved based on your language skill, you can solve the task by yourself.\\n 2. When you need to perform some task with code, use the code to perform the task and output the result. Finish the task smartly.\\nSolve the task step by step if you need to. If a plan is not provided, explain your plan first. Be clear which step uses code, and which step uses your language skill.\\nWhen using code, you must indicate the script type in the code block. The user cannot provide any other feedback or perform any other action beyond executing the code you suggest. The user can\\'t modify your code. So do not suggest incomplete code which requires users to modify. Don\\'t use a code block if it\\'s not intended to be executed by the user.\\nIf you want the user to save the code in a file before executing it, put # filename: <filename> inside the code block as the first line. Don\\'t include multiple code blocks in one response. Do not ask users to copy and paste the result. Instead, use \\'print\\' function for the output when relevant. Check the execution result returned by the user.\\nIf the result indicates there is an error, fix the error and output the code again. Suggest the full code instead of partial code or code changes. If the error can\\'t be fixed or if the task is not solved even after the code is executed successfully, analyze the problem, revisit your assumption, collect additional info you need, and think of a different approach to try.\\nWhen you find an answer, verify the answer carefully. Include verifiable evidence in your response if possible.\\nReply \"TERMINATE\" in the end when everything is done.\\n ', 'metadata': {}, 'model': 'gpt-4o', 'name': 'assistant', 'object': 'assistant', 'tools': [], 'response_format': 'auto', 'temperature': 1.0, 'tool_resources': ToolResources(code_interpreter=None, file_search=None), 'top_p': 1.0}\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"\u001B[33muser_proxy\u001B[0m (to assistant):\n",
"\n",
"Write a Python function that reverses a string.\n",
"\n",
"--------------------------------------------------------------------------------\n",
"\u001B[33massistant\u001B[0m (to user_proxy):\n",
"\n",
"Sure! Here is the Python code for a function that takes a string as input and returns the reversed string.\n",
"\n",
"```python\n",
"def reverse_string(s):\n",
" return s[::-1]\n",
"\n",
"# Example usage\n",
"if __name__ == \"__main__\":\n",
" example_string = \"Hello, world!\"\n",
" reversed_string = reverse_string(example_string)\n",
" print(f\"Original string: {example_string}\")\n",
" print(f\"Reversed string: {reversed_string}\")\n",
"```\n",
"\n",
"When you run this code, it will print the original string and the reversed string. You can replace `example_string` with any string you want to reverse.\n",
"\n",
"\n",
"--------------------------------------------------------------------------------\n",
"\u001B[31m\n",
">>>>>>>> EXECUTING CODE BLOCK 0 (inferred language is python)...\u001B[0m\n",
"\u001B[33muser_proxy\u001B[0m (to assistant):\n",
"\n",
"exitcode: 0 (execution succeeded)\n",
"Code output: \n",
"Original string: Hello, world!\n",
"Reversed string: !dlrow ,olleH\n",
"\n",
"\n",
"--------------------------------------------------------------------------------\n",
"\u001B[33massistant\u001B[0m (to user_proxy):\n",
"\n",
"Great, the function worked as expected! The original string \"Hello, world!\" was correctly reversed to \"!dlrow ,olleH\".\n",
"\n",
"If you have any other tasks or need further assistance, let me know! \n",
"\n",
"TERMINATE\n",
"\n",
"\n",
"--------------------------------------------------------------------------------\n"
]
},
{
"data": {
"text/plain": [
"ChatResult(chat_id=None, chat_history=[{'content': 'Write a Python function that reverses a string.', 'role': 'assistant', 'name': 'user_proxy'}, {'content': 'Sure! Here is the Python code for a function that takes a string as input and returns the reversed string.\\n\\n```python\\ndef reverse_string(s):\\n return s[::-1]\\n\\n# Example usage\\nif __name__ == \"__main__\":\\n example_string = \"Hello, world!\"\\n reversed_string = reverse_string(example_string)\\n print(f\"Original string: {example_string}\")\\n print(f\"Reversed string: {reversed_string}\")\\n```\\n\\nWhen you run this code, it will print the original string and the reversed string. You can replace `example_string` with any string you want to reverse.\\n', 'role': 'user', 'name': 'assistant'}, {'content': 'exitcode: 0 (execution succeeded)\\nCode output: \\nOriginal string: Hello, world!\\nReversed string: !dlrow ,olleH\\n', 'role': 'assistant', 'name': 'user_proxy'}, {'content': 'Great, the function worked as expected! The original string \"Hello, world!\" was correctly reversed to \"!dlrow ,olleH\".\\n\\nIf you have any other tasks or need further assistance, let me know! \\n\\nTERMINATE\\n', 'role': 'user', 'name': 'assistant'}], summary='Great, the function worked as expected! The original string \"Hello, world!\" was correctly reversed to \"!dlrow ,olleH\".\\n\\nIf you have any other tasks or need further assistance, let me know! \\n\\n\\n', cost={'usage_including_cached_inference': {'total_cost': 0}, 'usage_excluding_cached_inference': {'total_cost': 0}}, human_input=[])"
]
},
"execution_count": 12,
"metadata": {},
"output_type": "execute_result"
}
],
"execution_count": 12
]
},
{
"cell_type": "code",
"execution_count": 16,
"id": "c2fe6fd02324be37",
"metadata": {
"ExecuteTime": {
"end_time": "2024-09-25T20:31:40.536369Z",
"start_time": "2024-09-25T20:31:31.078911Z"
}
},
"cell_type": "code",
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"/var/folders/z6/3w4ng1lj3mn4vmhplgc4y0580000gn/T/ipykernel_77647/3850691550.py:28: DeprecationWarning: The current add API output format is deprecated. To use the latest format, set `api_version='v1.1'`. The current format will be removed in mem0ai 1.1.0 and later versions.\n",
" MEM0_MEMORY_CLIENT.add(MEMORY_DATA, user_id=USER_ID)\n",
"/var/folders/z6/3w4ng1lj3mn4vmhplgc4y0580000gn/T/ipykernel_77647/3850691550.py:29: DeprecationWarning: The current add API output format is deprecated. To use the latest format, set `api_version='v1.1'`. The current format will be removed in mem0ai 1.1.0 and later versions.\n",
" MEM0_MEMORY_CLIENT.add(MEMORY_DATA, agent_id=AGENT_ID)\n"
]
},
{
"data": {
"text/plain": [
"{'message': 'ok'}"
]
},
"execution_count": 16,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# Benefits of Preference Memory in AutoGen Agents:\n",
"# - Personalization: Tailors responses to individual user or team preferences.\n",
@@ -207,61 +231,28 @@
"# Add preference data to memory\n",
"MEM0_MEMORY_CLIENT.add(MEMORY_DATA, user_id=USER_ID)\n",
"MEM0_MEMORY_CLIENT.add(MEMORY_DATA, agent_id=AGENT_ID)"
],
"id": "c2fe6fd02324be37",
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"/var/folders/z6/3w4ng1lj3mn4vmhplgc4y0580000gn/T/ipykernel_77647/3850691550.py:28: DeprecationWarning: The current add API output format is deprecated. To use the latest format, set `api_version='v1.1'`. The current format will be removed in mem0ai 1.1.0 and later versions.\n",
" MEM0_MEMORY_CLIENT.add(MEMORY_DATA, user_id=USER_ID)\n",
"/var/folders/z6/3w4ng1lj3mn4vmhplgc4y0580000gn/T/ipykernel_77647/3850691550.py:29: DeprecationWarning: The current add API output format is deprecated. To use the latest format, set `api_version='v1.1'`. The current format will be removed in mem0ai 1.1.0 and later versions.\n",
" MEM0_MEMORY_CLIENT.add(MEMORY_DATA, agent_id=AGENT_ID)\n"
]
},
{
"data": {
"text/plain": [
"{'message': 'ok'}"
]
},
"execution_count": 16,
"metadata": {},
"output_type": "execute_result"
}
],
"execution_count": 16
]
},
{
"metadata": {},
"cell_type": "markdown",
"id": "fb6d6a8f36aedfd6",
"metadata": {},
"source": [
"## Option 1: \n",
"Using Direct Prompt Injection:\n",
"`user memory example`"
],
"id": "fb6d6a8f36aedfd6"
]
},
{
"cell_type": "code",
"execution_count": 17,
"id": "29be484c69093371",
"metadata": {
"ExecuteTime": {
"end_time": "2024-09-25T20:31:52.411604Z",
"start_time": "2024-09-25T20:31:40.611497Z"
}
},
"cell_type": "code",
"source": [
"# Retrieve the memory\n",
"relevant_memories = MEM0_MEMORY_CLIENT.search(user_query, user_id=USER_ID, limit=3)\n",
"relevant_memories_text = '\\n'.join(mem['memory'] for mem in relevant_memories)\n",
"print(f\"Relevant memories:\")\n",
"print(relevant_memories_text)\n",
"\n",
"prompt = f\"{user_query}\\n Coding Preferences: \\n{relevant_memories_text}\"\n",
"browse_result = user_proxy.initiate_chat(gpt_assistant, message=prompt)"
],
"id": "29be484c69093371",
"outputs": [
{
"name": "stderr",
@@ -280,7 +271,7 @@
"Prefers functions to have a descriptive docstring\n",
"Prefers camelCase for variable names\n",
"Prefers code to be explicitly written with clear variable names\n",
"\u001B[33muser_proxy\u001B[0m (to assistant):\n",
"\u001b[33muser_proxy\u001b[0m (to assistant):\n",
"\n",
"Write a Python function that reverses a string.\n",
" Coding Preferences: \n",
@@ -289,7 +280,7 @@
"Prefers code to be explicitly written with clear variable names\n",
"\n",
"--------------------------------------------------------------------------------\n",
"\u001B[33massistant\u001B[0m (to user_proxy):\n",
"\u001b[33massistant\u001b[0m (to user_proxy):\n",
"\n",
"Sure, I will write a Python function that reverses a given string with clear and descriptive variable names, along with a descriptive docstring.\n",
"\n",
@@ -324,9 +315,9 @@
"\n",
"\n",
"--------------------------------------------------------------------------------\n",
"\u001B[31m\n",
">>>>>>>> EXECUTING CODE BLOCK 0 (inferred language is python)...\u001B[0m\n",
"\u001B[33muser_proxy\u001B[0m (to assistant):\n",
"\u001b[31m\n",
">>>>>>>> EXECUTING CODE BLOCK 0 (inferred language is python)...\u001b[0m\n",
"\u001b[33muser_proxy\u001b[0m (to assistant):\n",
"\n",
"exitcode: 0 (execution succeeded)\n",
"Code output: \n",
@@ -335,7 +326,7 @@
"\n",
"\n",
"--------------------------------------------------------------------------------\n",
"\u001B[33massistant\u001B[0m (to user_proxy):\n",
"\u001b[33massistant\u001b[0m (to user_proxy):\n",
"\n",
"Great! It looks like the code executed successfully and produced the correct output, reversing the string \"Hello World!\" to \"!dlroW olleH\".\n",
"\n",
@@ -354,26 +345,38 @@
]
}
],
"execution_count": 17
"source": [
"# Retrieve the memory\n",
"relevant_memories = MEM0_MEMORY_CLIENT.search(user_query, user_id=USER_ID, limit=3)\n",
"relevant_memories_text = '\\n'.join(mem['memory'] for mem in relevant_memories)\n",
"print(\"Relevant memories:\")\n",
"print(relevant_memories_text)\n",
"\n",
"prompt = f\"{user_query}\\n Coding Preferences: \\n{relevant_memories_text}\"\n",
"browse_result = user_proxy.initiate_chat(gpt_assistant, message=prompt)"
]
},
{
"metadata": {},
"cell_type": "markdown",
"id": "fc0ae72d0ef7f6de",
"metadata": {},
"source": [
"## Option 2:\n",
"Using UserProxyAgent: \n",
"`agent memory example`"
],
"id": "fc0ae72d0ef7f6de"
]
},
{
"cell_type": "code",
"execution_count": 18,
"id": "bfd9342cf2096ca5",
"metadata": {
"ExecuteTime": {
"end_time": "2024-09-25T20:31:52.421965Z",
"start_time": "2024-09-25T20:31:52.418762Z"
}
},
"cell_type": "code",
"outputs": [],
"source": [
"# UserProxyAgent in AutoGen:\n",
"# - Acts as intermediary between humans and AI agents in the AutoGen framework.\n",
@@ -405,39 +408,24 @@
" self.memory.add(MEMORY_DATA, agent_id=self.agent_id)\n",
" return response\n",
" "
],
"id": "bfd9342cf2096ca5",
"outputs": [],
"execution_count": 18
]
},
{
"cell_type": "code",
"execution_count": 19,
"id": "6d2a757d1cf65881",
"metadata": {
"ExecuteTime": {
"end_time": "2024-09-25T20:32:20.269222Z",
"start_time": "2024-09-25T20:32:07.485051Z"
}
},
"cell_type": "code",
"source": [
"mem0_user_proxy = Mem0ProxyCoderAgent(\n",
" name=AGENT_ID,\n",
" code_execution_config={\n",
" \"work_dir\": \"coding\",\n",
" \"use_docker\": False,\n",
" }, # Please set use_docker=True if docker is available to run the generated code. Using docker is safer than running the generated code directly.\n",
" is_termination_msg=lambda msg: \"TERMINATE\" in msg[\"content\"],\n",
" human_input_mode=\"NEVER\",\n",
" max_consecutive_auto_reply=1,\n",
")\n",
"code_result = mem0_user_proxy.initiate_chat(gpt_assistant, message=user_query)"
],
"id": "6d2a757d1cf65881",
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\u001B[33mchicory.ai\u001B[0m (to assistant):\n",
"\u001b[33mchicory.ai\u001b[0m (to assistant):\n",
"\n",
"Write a Python function that reverses a string.\n",
" Coding Preferences: \n",
@@ -460,7 +448,7 @@
"name": "stdout",
"output_type": "stream",
"text": [
"\u001B[33massistant\u001B[0m (to chicory.ai):\n",
"\u001b[33massistant\u001b[0m (to chicory.ai):\n",
"\n",
"Sure, I'll write a Python function that reverses a string following your coding preferences.\n",
"\n",
@@ -487,9 +475,9 @@
"\n",
"\n",
"--------------------------------------------------------------------------------\n",
"\u001B[31m\n",
">>>>>>>> EXECUTING CODE BLOCK 0 (inferred language is python)...\u001B[0m\n",
"\u001B[33mchicory.ai\u001B[0m (to assistant):\n",
"\u001b[31m\n",
">>>>>>>> EXECUTING CODE BLOCK 0 (inferred language is python)...\u001b[0m\n",
"\u001b[33mchicory.ai\u001b[0m (to assistant):\n",
"\n",
"exitcode: 0 (execution succeeded)\n",
"Code output: \n",
@@ -497,7 +485,7 @@
"\n",
"\n",
"--------------------------------------------------------------------------------\n",
"\u001B[33massistant\u001B[0m (to chicory.ai):\n",
"\u001b[33massistant\u001b[0m (to chicory.ai):\n",
"\n",
"Great! The function has successfully reversed the string as expected.\n",
"\n",
@@ -518,26 +506,41 @@
]
}
],
"execution_count": 19
"source": [
"mem0_user_proxy = Mem0ProxyCoderAgent(\n",
" name=AGENT_ID,\n",
" code_execution_config={\n",
" \"work_dir\": \"coding\",\n",
" \"use_docker\": False,\n",
" }, # Please set use_docker=True if docker is available to run the generated code. Using docker is safer than running the generated code directly.\n",
" is_termination_msg=lambda msg: \"TERMINATE\" in msg[\"content\"],\n",
" human_input_mode=\"NEVER\",\n",
" max_consecutive_auto_reply=1,\n",
")\n",
"code_result = mem0_user_proxy.initiate_chat(gpt_assistant, message=user_query)"
]
},
{
"metadata": {},
"cell_type": "markdown",
"id": "7706c06216ca4374",
"metadata": {},
"source": [
"# Option 3:\n",
"Using Teachability:\n",
"`agent memory example`"
],
"id": "7706c06216ca4374"
]
},
{
"cell_type": "code",
"execution_count": 20,
"id": "ae6bb87061877645",
"metadata": {
"ExecuteTime": {
"end_time": "2024-09-25T20:33:17.737146Z",
"start_time": "2024-09-25T20:33:17.713250Z"
}
},
"cell_type": "code",
"outputs": [],
"source": [
"# building on top of existing Teachability package from autogen\n",
"# from autogen.agentchat.contrib.capabilities.teachability import Teachability\n",
@@ -564,24 +567,18 @@
" memory_client = MEM0_MEMORY_CLIENT,\n",
" )\n",
"teachability.add_to_agent(user_proxy)"
],
"id": "ae6bb87061877645",
"outputs": [],
"execution_count": 20
]
},
{
"cell_type": "code",
"execution_count": 21,
"id": "36c9bcbedcd406b4",
"metadata": {
"ExecuteTime": {
"end_time": "2024-09-25T20:33:46.616261Z",
"start_time": "2024-09-25T20:33:19.719999Z"
}
},
"cell_type": "code",
"source": [
"# Initiate Chat w/ Teachability + Memory\n",
"user_proxy.initiate_chat(gpt_assistant, message=user_query)"
],
"id": "36c9bcbedcd406b4",
"outputs": [
{
"name": "stderr",
@@ -594,12 +591,12 @@
"name": "stdout",
"output_type": "stream",
"text": [
"\u001B[33muser_proxy\u001B[0m (to assistant):\n",
"\u001b[33muser_proxy\u001b[0m (to assistant):\n",
"\n",
"Write a Python function that reverses a string.\n",
"\n",
"--------------------------------------------------------------------------------\n",
"\u001B[33massistant\u001B[0m (to user_proxy):\n",
"\u001b[33massistant\u001b[0m (to user_proxy):\n",
"\n",
"Sure, I'll provide you with a Python function that takes a string as input and returns the reversed string. Here is the complete code:\n",
"\n",
@@ -626,9 +623,9 @@
"\n",
"\n",
"--------------------------------------------------------------------------------\n",
"\u001B[93m\n",
"LOOK FOR RELEVANT MEMOS, AS QUESTION-ANSWER PAIRS\u001B[0m\n",
"\u001B[33muser_proxy\u001B[0m (to analyzer):\n",
"\u001b[93m\n",
"LOOK FOR RELEVANT MEMOS, AS QUESTION-ANSWER PAIRS\u001b[0m\n",
"\u001b[33muser_proxy\u001b[0m (to analyzer):\n",
"\n",
"Sure, I'll provide you with a Python function that takes a string as input and returns the reversed string. Here is the complete code:\n",
"\n",
@@ -655,19 +652,19 @@
"\n",
"\n",
"--------------------------------------------------------------------------------\n",
"\u001B[33muser_proxy\u001B[0m (to analyzer):\n",
"\u001b[33muser_proxy\u001b[0m (to analyzer):\n",
"\n",
"Does any part of the TEXT ask the agent to perform a task or solve a problem? Answer with just one word, yes or no.\n",
"\n",
"--------------------------------------------------------------------------------\n",
"\u001B[33manalyzer\u001B[0m (to user_proxy):\n",
"\u001b[33manalyzer\u001b[0m (to user_proxy):\n",
"\n",
"Yes\n",
"\n",
"--------------------------------------------------------------------------------\n",
"\u001B[93m\n",
"LOOK FOR RELEVANT MEMOS, AS TASK-ADVICE PAIRS\u001B[0m\n",
"\u001B[33muser_proxy\u001B[0m (to analyzer):\n",
"\u001b[93m\n",
"LOOK FOR RELEVANT MEMOS, AS TASK-ADVICE PAIRS\u001b[0m\n",
"\u001b[33muser_proxy\u001b[0m (to analyzer):\n",
"\n",
"Sure, I'll provide you with a Python function that takes a string as input and returns the reversed string. Here is the complete code:\n",
"\n",
@@ -694,32 +691,32 @@
"\n",
"\n",
"--------------------------------------------------------------------------------\n",
"\u001B[33muser_proxy\u001B[0m (to analyzer):\n",
"\u001b[33muser_proxy\u001b[0m (to analyzer):\n",
"\n",
"Copy just the task from the TEXT, then stop. Don't solve it, and don't include any advice.\n",
"\n",
"--------------------------------------------------------------------------------\n",
"\u001B[33manalyzer\u001B[0m (to user_proxy):\n",
"\u001b[33manalyzer\u001b[0m (to user_proxy):\n",
"\n",
"Save the above code in a file named `reverse_string.py`, then execute it. This script defines the `reverse_string` function and demonstrates its usage by reversing the string \"Hello, World!\". It will print both the original and reversed strings.\n",
"\n",
"--------------------------------------------------------------------------------\n",
"\u001B[33muser_proxy\u001B[0m (to analyzer):\n",
"\u001b[33muser_proxy\u001b[0m (to analyzer):\n",
"\n",
"Save the above code in a file named `reverse_string.py`, then execute it. This script defines the `reverse_string` function and demonstrates its usage by reversing the string \"Hello, World!\". It will print both the original and reversed strings.\n",
"\n",
"--------------------------------------------------------------------------------\n",
"\u001B[33muser_proxy\u001B[0m (to analyzer):\n",
"\u001b[33muser_proxy\u001b[0m (to analyzer):\n",
"\n",
"Summarize very briefly, in general terms, the type of task described in the TEXT. Leave out details that might not appear in a similar problem.\n",
"\n",
"--------------------------------------------------------------------------------\n",
"\u001B[33manalyzer\u001B[0m (to user_proxy):\n",
"\u001b[33manalyzer\u001b[0m (to user_proxy):\n",
"\n",
"The task involves saving a script to a file, executing it, and demonstrating a function that reverses a string.\n",
"\n",
"--------------------------------------------------------------------------------\n",
"\u001B[93m\n",
"\u001b[93m\n",
"MEMOS APPENDED TO LAST MESSAGE...\n",
"\n",
"# Memories that might help\n",
@@ -728,8 +725,8 @@
"- Prefers comments explaining each step\n",
"- Prefers code to be explicitly written with clear variable names\n",
"\n",
"\u001B[0m\n",
"\u001B[33muser_proxy\u001B[0m (to analyzer):\n",
"\u001b[0m\n",
"\u001b[33muser_proxy\u001b[0m (to analyzer):\n",
"\n",
"Sure, I'll provide you with a Python function that takes a string as input and returns the reversed string. Here is the complete code:\n",
"\n",
@@ -756,17 +753,17 @@
"\n",
"\n",
"--------------------------------------------------------------------------------\n",
"\u001B[33muser_proxy\u001B[0m (to analyzer):\n",
"\u001b[33muser_proxy\u001b[0m (to analyzer):\n",
"\n",
"Does any part of the TEXT ask the agent to perform a task or solve a problem? Answer with just one word, yes or no.\n",
"\n",
"--------------------------------------------------------------------------------\n",
"\u001B[33manalyzer\u001B[0m (to user_proxy):\n",
"\u001b[33manalyzer\u001b[0m (to user_proxy):\n",
"\n",
"Yes\n",
"\n",
"--------------------------------------------------------------------------------\n",
"\u001B[33muser_proxy\u001B[0m (to analyzer):\n",
"\u001b[33muser_proxy\u001b[0m (to analyzer):\n",
"\n",
"Sure, I'll provide you with a Python function that takes a string as input and returns the reversed string. Here is the complete code:\n",
"\n",
@@ -793,17 +790,17 @@
"\n",
"\n",
"--------------------------------------------------------------------------------\n",
"\u001B[33muser_proxy\u001B[0m (to analyzer):\n",
"\u001b[33muser_proxy\u001b[0m (to analyzer):\n",
"\n",
"Briefly copy any advice from the TEXT that may be useful for a similar but different task in the future. But if no advice is present, just respond with 'none'.\n",
"\n",
"--------------------------------------------------------------------------------\n",
"\u001B[33manalyzer\u001B[0m (to user_proxy):\n",
"\u001b[33manalyzer\u001b[0m (to user_proxy):\n",
"\n",
"Save the above code in a file named `reverse_string.py`, then execute it.\n",
"\n",
"--------------------------------------------------------------------------------\n",
"\u001B[33muser_proxy\u001B[0m (to analyzer):\n",
"\u001b[33muser_proxy\u001b[0m (to analyzer):\n",
"\n",
"Sure, I'll provide you with a Python function that takes a string as input and returns the reversed string. Here is the complete code:\n",
"\n",
@@ -830,34 +827,34 @@
"\n",
"\n",
"--------------------------------------------------------------------------------\n",
"\u001B[33muser_proxy\u001B[0m (to analyzer):\n",
"\u001b[33muser_proxy\u001b[0m (to analyzer):\n",
"\n",
"Briefly copy just the task from the TEXT, then stop. Don't solve it, and don't include any advice.\n",
"\n",
"--------------------------------------------------------------------------------\n",
"\u001B[33manalyzer\u001B[0m (to user_proxy):\n",
"\u001b[33manalyzer\u001b[0m (to user_proxy):\n",
"\n",
"Save the above code in a file named `reverse_string.py`, then execute it. This script defines the `reverse_string` function and demonstrates its usage by reversing the string \"Hello, World!\". It will print both the original and reversed strings.\n",
"\n",
"--------------------------------------------------------------------------------\n",
"\u001B[33muser_proxy\u001B[0m (to analyzer):\n",
"\u001b[33muser_proxy\u001b[0m (to analyzer):\n",
"\n",
"Save the above code in a file named `reverse_string.py`, then execute it. This script defines the `reverse_string` function and demonstrates its usage by reversing the string \"Hello, World!\". It will print both the original and reversed strings.\n",
"\n",
"--------------------------------------------------------------------------------\n",
"\u001B[33muser_proxy\u001B[0m (to analyzer):\n",
"\u001b[33muser_proxy\u001b[0m (to analyzer):\n",
"\n",
"Summarize very briefly, in general terms, the type of task described in the TEXT. Leave out details that might not appear in a similar problem.\n",
"\n",
"--------------------------------------------------------------------------------\n",
"\u001B[33manalyzer\u001B[0m (to user_proxy):\n",
"\u001b[33manalyzer\u001b[0m (to user_proxy):\n",
"\n",
"The task involves saving a script to a file, executing it, and demonstrating a function that reverses a string.\n",
"\n",
"--------------------------------------------------------------------------------\n",
"\u001B[93m\n",
"REMEMBER THIS TASK-ADVICE PAIR\u001B[0m\n",
"\u001B[33muser_proxy\u001B[0m (to analyzer):\n",
"\u001b[93m\n",
"REMEMBER THIS TASK-ADVICE PAIR\u001b[0m\n",
"\u001b[33muser_proxy\u001b[0m (to analyzer):\n",
"\n",
"Sure, I'll provide you with a Python function that takes a string as input and returns the reversed string. Here is the complete code:\n",
"\n",
@@ -884,17 +881,17 @@
"\n",
"\n",
"--------------------------------------------------------------------------------\n",
"\u001B[33muser_proxy\u001B[0m (to analyzer):\n",
"\u001b[33muser_proxy\u001b[0m (to analyzer):\n",
"\n",
"Does the TEXT contain information that could be committed to memory? Answer with just one word, yes or no.\n",
"\n",
"--------------------------------------------------------------------------------\n",
"\u001B[33manalyzer\u001B[0m (to user_proxy):\n",
"\u001b[33manalyzer\u001b[0m (to user_proxy):\n",
"\n",
"Yes\n",
"\n",
"--------------------------------------------------------------------------------\n",
"\u001B[33muser_proxy\u001B[0m (to analyzer):\n",
"\u001b[33muser_proxy\u001b[0m (to analyzer):\n",
"\n",
"Sure, I'll provide you with a Python function that takes a string as input and returns the reversed string. Here is the complete code:\n",
"\n",
@@ -921,17 +918,17 @@
"\n",
"\n",
"--------------------------------------------------------------------------------\n",
"\u001B[33muser_proxy\u001B[0m (to analyzer):\n",
"\u001b[33muser_proxy\u001b[0m (to analyzer):\n",
"\n",
"Imagine that the user forgot this information in the TEXT. How would they ask you for this information? Include no other text in your response.\n",
"\n",
"--------------------------------------------------------------------------------\n",
"\u001B[33manalyzer\u001B[0m (to user_proxy):\n",
"\u001b[33manalyzer\u001b[0m (to user_proxy):\n",
"\n",
"How do I reverse a string in Python?\n",
"\n",
"--------------------------------------------------------------------------------\n",
"\u001B[33muser_proxy\u001B[0m (to analyzer):\n",
"\u001b[33muser_proxy\u001b[0m (to analyzer):\n",
"\n",
"Sure, I'll provide you with a Python function that takes a string as input and returns the reversed string. Here is the complete code:\n",
"\n",
@@ -958,12 +955,12 @@
"\n",
"\n",
"--------------------------------------------------------------------------------\n",
"\u001B[33muser_proxy\u001B[0m (to analyzer):\n",
"\u001b[33muser_proxy\u001b[0m (to analyzer):\n",
"\n",
"Copy the information from the TEXT that should be committed to memory. Add no explanation.\n",
"\n",
"--------------------------------------------------------------------------------\n",
"\u001B[33manalyzer\u001B[0m (to user_proxy):\n",
"\u001b[33manalyzer\u001b[0m (to user_proxy):\n",
"\n",
"```python\n",
"# filename: reverse_string.py\n",
@@ -985,11 +982,11 @@
"```\n",
"\n",
"--------------------------------------------------------------------------------\n",
"\u001B[93m\n",
"REMEMBER THIS QUESTION-ANSWER PAIR\u001B[0m\n",
"\u001B[31m\n",
">>>>>>>> EXECUTING CODE BLOCK 0 (inferred language is python)...\u001B[0m\n",
"\u001B[33muser_proxy\u001B[0m (to assistant):\n",
"\u001b[93m\n",
"REMEMBER THIS QUESTION-ANSWER PAIR\u001b[0m\n",
"\u001b[31m\n",
">>>>>>>> EXECUTING CODE BLOCK 0 (inferred language is python)...\u001b[0m\n",
"\u001b[33muser_proxy\u001b[0m (to assistant):\n",
"\n",
"exitcode: 0 (execution succeeded)\n",
"Code output: \n",
@@ -998,7 +995,7 @@
"\n",
"\n",
"--------------------------------------------------------------------------------\n",
"\u001B[33massistant\u001B[0m (to user_proxy):\n",
"\u001b[33massistant\u001b[0m (to user_proxy):\n",
"\n",
"The code executed successfully, and the output is correct. The string \"Hello, World!\" was successfully reversed to \"!dlroW ,olleH\".\n",
"\n",
@@ -1008,9 +1005,9 @@
"\n",
"\n",
"--------------------------------------------------------------------------------\n",
"\u001B[93m\n",
"LOOK FOR RELEVANT MEMOS, AS QUESTION-ANSWER PAIRS\u001B[0m\n",
"\u001B[33muser_proxy\u001B[0m (to analyzer):\n",
"\u001b[93m\n",
"LOOK FOR RELEVANT MEMOS, AS QUESTION-ANSWER PAIRS\u001b[0m\n",
"\u001b[33muser_proxy\u001b[0m (to analyzer):\n",
"\n",
"The code executed successfully, and the output is correct. The string \"Hello, World!\" was successfully reversed to \"!dlroW ,olleH\".\n",
"\n",
@@ -1020,19 +1017,19 @@
"\n",
"\n",
"--------------------------------------------------------------------------------\n",
"\u001B[33muser_proxy\u001B[0m (to analyzer):\n",
"\u001b[33muser_proxy\u001b[0m (to analyzer):\n",
"\n",
"Does any part of the TEXT ask the agent to perform a task or solve a problem? Answer with just one word, yes or no.\n",
"\n",
"--------------------------------------------------------------------------------\n",
"\u001B[33manalyzer\u001B[0m (to user_proxy):\n",
"\u001b[33manalyzer\u001b[0m (to user_proxy):\n",
"\n",
"Yes\n",
"\n",
"--------------------------------------------------------------------------------\n",
"\u001B[93m\n",
"LOOK FOR RELEVANT MEMOS, AS TASK-ADVICE PAIRS\u001B[0m\n",
"\u001B[33muser_proxy\u001B[0m (to analyzer):\n",
"\u001b[93m\n",
"LOOK FOR RELEVANT MEMOS, AS TASK-ADVICE PAIRS\u001b[0m\n",
"\u001b[33muser_proxy\u001b[0m (to analyzer):\n",
"\n",
"The code executed successfully, and the output is correct. The string \"Hello, World!\" was successfully reversed to \"!dlroW ,olleH\".\n",
"\n",
@@ -1042,32 +1039,32 @@
"\n",
"\n",
"--------------------------------------------------------------------------------\n",
"\u001B[33muser_proxy\u001B[0m (to analyzer):\n",
"\u001b[33muser_proxy\u001b[0m (to analyzer):\n",
"\n",
"Copy just the task from the TEXT, then stop. Don't solve it, and don't include any advice.\n",
"\n",
"--------------------------------------------------------------------------------\n",
"\u001B[33manalyzer\u001B[0m (to user_proxy):\n",
"\u001b[33manalyzer\u001b[0m (to user_proxy):\n",
"\n",
"If you have any other tasks or need further assistance, feel free to ask.\n",
"\n",
"--------------------------------------------------------------------------------\n",
"\u001B[33muser_proxy\u001B[0m (to analyzer):\n",
"\u001b[33muser_proxy\u001b[0m (to analyzer):\n",
"\n",
"If you have any other tasks or need further assistance, feel free to ask.\n",
"\n",
"--------------------------------------------------------------------------------\n",
"\u001B[33muser_proxy\u001B[0m (to analyzer):\n",
"\u001b[33muser_proxy\u001b[0m (to analyzer):\n",
"\n",
"Summarize very briefly, in general terms, the type of task described in the TEXT. Leave out details that might not appear in a similar problem.\n",
"\n",
"--------------------------------------------------------------------------------\n",
"\u001B[33manalyzer\u001B[0m (to user_proxy):\n",
"\u001b[33manalyzer\u001b[0m (to user_proxy):\n",
"\n",
"The task described in the TEXT involves offering help or assistance with various tasks.\n",
"\n",
"--------------------------------------------------------------------------------\n",
"\u001B[93m\n",
"\u001b[93m\n",
"MEMOS APPENDED TO LAST MESSAGE...\n",
"\n",
"# Memories that might help\n",
@@ -1078,8 +1075,8 @@
"- Code should be saved in a file named 'reverse_string.py'\n",
"- Prefers camelCase for variable names\n",
"\n",
"\u001B[0m\n",
"\u001B[33muser_proxy\u001B[0m (to analyzer):\n",
"\u001b[0m\n",
"\u001b[33muser_proxy\u001b[0m (to analyzer):\n",
"\n",
"The code executed successfully, and the output is correct. The string \"Hello, World!\" was successfully reversed to \"!dlroW ,olleH\".\n",
"\n",
@@ -1089,17 +1086,17 @@
"\n",
"\n",
"--------------------------------------------------------------------------------\n",
"\u001B[33muser_proxy\u001B[0m (to analyzer):\n",
"\u001b[33muser_proxy\u001b[0m (to analyzer):\n",
"\n",
"Does any part of the TEXT ask the agent to perform a task or solve a problem? Answer with just one word, yes or no.\n",
"\n",
"--------------------------------------------------------------------------------\n",
"\u001B[33manalyzer\u001B[0m (to user_proxy):\n",
"\u001b[33manalyzer\u001b[0m (to user_proxy):\n",
"\n",
"Yes\n",
"\n",
"--------------------------------------------------------------------------------\n",
"\u001B[33muser_proxy\u001B[0m (to analyzer):\n",
"\u001b[33muser_proxy\u001b[0m (to analyzer):\n",
"\n",
"The code executed successfully, and the output is correct. The string \"Hello, World!\" was successfully reversed to \"!dlroW ,olleH\".\n",
"\n",
@@ -1109,17 +1106,17 @@
"\n",
"\n",
"--------------------------------------------------------------------------------\n",
"\u001B[33muser_proxy\u001B[0m (to analyzer):\n",
"\u001b[33muser_proxy\u001b[0m (to analyzer):\n",
"\n",
"Briefly copy any advice from the TEXT that may be useful for a similar but different task in the future. But if no advice is present, just respond with 'none'.\n",
"\n",
"--------------------------------------------------------------------------------\n",
"\u001B[33manalyzer\u001B[0m (to user_proxy):\n",
"\u001b[33manalyzer\u001b[0m (to user_proxy):\n",
"\n",
"none\n",
"\n",
"--------------------------------------------------------------------------------\n",
"\u001B[33muser_proxy\u001B[0m (to analyzer):\n",
"\u001b[33muser_proxy\u001b[0m (to analyzer):\n",
"\n",
"The code executed successfully, and the output is correct. The string \"Hello, World!\" was successfully reversed to \"!dlroW ,olleH\".\n",
"\n",
@@ -1129,17 +1126,17 @@
"\n",
"\n",
"--------------------------------------------------------------------------------\n",
"\u001B[33muser_proxy\u001B[0m (to analyzer):\n",
"\u001b[33muser_proxy\u001b[0m (to analyzer):\n",
"\n",
"Does the TEXT contain information that could be committed to memory? Answer with just one word, yes or no.\n",
"\n",
"--------------------------------------------------------------------------------\n",
"\u001B[33manalyzer\u001B[0m (to user_proxy):\n",
"\u001b[33manalyzer\u001b[0m (to user_proxy):\n",
"\n",
"Yes\n",
"\n",
"--------------------------------------------------------------------------------\n",
"\u001B[33muser_proxy\u001B[0m (to analyzer):\n",
"\u001b[33muser_proxy\u001b[0m (to analyzer):\n",
"\n",
"The code executed successfully, and the output is correct. The string \"Hello, World!\" was successfully reversed to \"!dlroW ,olleH\".\n",
"\n",
@@ -1149,17 +1146,17 @@
"\n",
"\n",
"--------------------------------------------------------------------------------\n",
"\u001B[33muser_proxy\u001B[0m (to analyzer):\n",
"\u001b[33muser_proxy\u001b[0m (to analyzer):\n",
"\n",
"Imagine that the user forgot this information in the TEXT. How would they ask you for this information? Include no other text in your response.\n",
"\n",
"--------------------------------------------------------------------------------\n",
"\u001B[33manalyzer\u001B[0m (to user_proxy):\n",
"\u001b[33manalyzer\u001b[0m (to user_proxy):\n",
"\n",
"What was the original string that was reversed to \"!dlroW ,olleH\"?\n",
"\n",
"--------------------------------------------------------------------------------\n",
"\u001B[33muser_proxy\u001B[0m (to analyzer):\n",
"\u001b[33muser_proxy\u001b[0m (to analyzer):\n",
"\n",
"The code executed successfully, and the output is correct. The string \"Hello, World!\" was successfully reversed to \"!dlroW ,olleH\".\n",
"\n",
@@ -1169,18 +1166,18 @@
"\n",
"\n",
"--------------------------------------------------------------------------------\n",
"\u001B[33muser_proxy\u001B[0m (to analyzer):\n",
"\u001b[33muser_proxy\u001b[0m (to analyzer):\n",
"\n",
"Copy the information from the TEXT that should be committed to memory. Add no explanation.\n",
"\n",
"--------------------------------------------------------------------------------\n",
"\u001B[33manalyzer\u001B[0m (to user_proxy):\n",
"\u001b[33manalyzer\u001b[0m (to user_proxy):\n",
"\n",
"The string \"Hello, World!\" was successfully reversed to \"!dlroW ,olleH\".\n",
"\n",
"--------------------------------------------------------------------------------\n",
"\u001B[93m\n",
"REMEMBER THIS QUESTION-ANSWER PAIR\u001B[0m\n"
"\u001b[93m\n",
"REMEMBER THIS QUESTION-ANSWER PAIR\u001b[0m\n"
]
},
{
@@ -1194,7 +1191,10 @@
"output_type": "execute_result"
}
],
"execution_count": 21
"source": [
"# Initiate Chat w/ Teachability + Memory\n",
"user_proxy.initiate_chat(gpt_assistant, message=user_query)"
]
}
],
"metadata": {
+3
View File
@@ -0,0 +1,3 @@
<Note type="info">
📢 Announcing our research paper: Mem0 achieves <strong>26%</strong> higher accuracy than OpenAI Memory, <strong>91%</strong> lower latency, and <strong>90%</strong> token savings! [Read the paper](https://mem0.ai/research) to learn how we're revolutionizing AI agent memory.
</Note>
+2
View File
@@ -4,6 +4,8 @@ icon: "info"
iconType: "solid"
---
<Snippet file="paper-release.mdx" />
Mem0 provides a powerful set of APIs that allow you to integrate advanced memory management capabilities into your applications. Our APIs are designed to be intuitive, efficient, and scalable, enabling you to create, retrieve, update, and delete memories across various entities such as users, agents, apps, and runs.
## Key Features
@@ -14,11 +14,11 @@ The v2 search API is powerful and flexible, allowing for more precise memory ret
<CodeGroup>
```python Code
related_memories = m.vsearch(
related_memories = m.search(
query="What are Alice's hobbies?",
version="v2",
filters={
"AND": [
"OR": [
{
"user_id": "alice"
},
+221
View File
@@ -3,9 +3,91 @@ title: "Product Updates"
mode: "wide"
---
<Snippet file="paper-release.mdx" />
<Tabs>
<Tab title="Python">
<Update label="2025-04-26" description="v0.1.94">
**New Features:**
- **Integrations:** Added Memgraph integration
- **Memory:** Added timestamp support
- **Vector Stores:** Added reset function for VectorDBs
**Improvements:**
- **Documentation:**
- Updated timestamp and expiration_date documentation
- Fixed v2 search documentation
- Added "memory" in EC "Custom config" section
- Fixed typos in the json config sample
</Update>
<Update label="2025-04-21" description="v0.1.93">
**Improvements:**
- **Vector Stores:** Initialized embedding_model_dims in all vectordbs
**Bug Fixes:**
- **Documentation:** Fixed agno link
</Update>
<Update label="2025-04-18" description="v0.1.92">
**New Features:**
- **Memory:** Added Memory Reset functionality
- **Client:** Added support for Custom Instructions
- **Examples:** Added Fitness Checker powered by memory
**Improvements:**
- **Core:** Updated capture_event
- **Documentation:** Fixed curl for v2 get_all
**Bug Fixes:**
- **Vector Store:** Fixed user_id functionality
- **Client:** Various client improvements
</Update>
<Update label="2025-04-16" description="v0.1.91">
**New Features:**
- **LLM Integrations:** Added Azure OpenAI Embedding Model
- **Examples:**
- Added movie recommendation using grok3
- Added Voice Assistant using Elevenlabs
**Improvements:**
- **Documentation:**
- Added keywords AI
- Reformatted navbar page URLs
- Updated changelog
- Updated openai.mdx
- **FAISS:** Silenced FAISS info logs
</Update>
<Update label="2025-04-11" description="v0.1.90">
**New Features:**
- **LLM Integrations:** Added Mistral AI as LLM provider
**Improvements:**
- **Documentation:**
- Updated changelog
- Fixed memory exclusion example
- Updated xAI documentation
- Updated YouTube Chrome extension example documentation
**Bug Fixes:**
- **Core:** Fixed EmbedderFactory.create() in GraphMemory
- **Azure OpenAI:** Added patch to fix Azure OpenAI
- **Telemetry:** Fixed telemetry issue
</Update>
<Update label="2025-04-11" description="v0.1.89">
**New Features:**
@@ -127,6 +209,47 @@ mode: "wide"
<Tab title="TypeScript">
<Update label="2025-05-08" description="v2.1.25">
**Improvements:**
- **Client:** Improved error handling in client.
</Update>
<Update label="2025-05-06" description="v2.1.24">
**New Features:**
- **Client:** Added new param `output_format` to match Python SDK.
- **Client:** Added new enum `OutputFormat` for `v1.0` and `v1.1`
</Update>
<Update label="2025-05-05" description="v2.1.23">
**New Features:**
- **Client:** Updated `deleteUsers` to use `v2` API.
- **Client:** Deprecated `deleteUser` and added deprecation warning.
</Update>
<Update label="2025-05-02" description="v2.1.22">
**New Features:**
- **Client:** Updated `deleteUser` to use `entity_id` and `entity_type`
</Update>
<Update label="2025-05-01" description="v2.1.21">
**Improvements:**
- **OSS SDK:** Bumped version of `@anthropic-ai/sdk` to `0.40.1`
</Update>
<Update label="2025-04-28" description="v2.1.20">
**Improvements:**
- **Client:** Fixed `organizationId` and `projectId` being asssigned to default in `ping` method
</Update>
<Update label="2025-04-22" description="v2.1.19">
**Improvements:**
- **Client:** Added support for `timestamps`
</Update>
<Update label="2025-04-17" description="v2.1.18">
**Improvements:**
- **Client:** Added support for custom instructions
</Update>
<Update label="2025-04-15" description="v2.1.17">
**New Features:**
@@ -207,6 +330,84 @@ mode: "wide"
<Tab title="Platform">
<Update label="2025-04-26" description="">
**Improvements:**
- **Performance:** Parallelized embedding calls
- **Monitoring:** Added timing for LLM calls
- **Search:** Added category checking in Search V2
- **Bug Fixes:** Fixed issues with ADD filters
- **Graph:** Implemented new graph updates
</Update>
<Update label="2025-04-25" description="">
**Improvements:**
- **Memory:** Fixed memory export functionality
- **Analytics:** Added logging for project
</Update>
<Update label="2025-04-24" description="">
**Improvements:**
- **Output:** Added memory_type display for ADD output
</Update>
<Update label="2025-04-23" description="">
**New Features:**
- **UI:** Added new Pricing Component
- **Memory:** Implemented Long/Short term memory categorization
- **Output:** Modified serializer to hide memory_type
**Documentation:**
- Updated README for deployment
</Update>
<Update label="2025-04-22" description="">
**New Features:**
- **Memory:** Added timestamp to ADD call
**Bug Fixes:**
- Fixed issues with coreV2
</Update>
<Update label="2025-04-21" description="">
**New Features:**
- **Memory:** Implemented backdating with migrations and backfilling script
</Update>
<Update label="2025-04-17" description="">
**New Features:**
- **Billing:** Integrated Stripe Billing Dashboard
- **Admin:** Added webhook creation functionality
**Bug Fixes:**
- Fixed Users Page issues
- Fixed Custom Categories
- Fixed Table components
- Updated Stripe configuration
</Update>
<Update label="2025-04-16" description="">
**Improvements:**
- **Performance:** Made Admin panel and Memory Page faster
- **Security:** Implemented active session cancellation
- **Analytics:** Added Stripe customer ID capture
</Update>
<Update label="2025-04-12" description="">
**New Features:**
@@ -283,5 +484,25 @@ mode: "wide"
</Update>
</Tab>
<Tab title="Vercel AI SDK">
<Update label="2025-05-10" description="v1.0.4">
**New Features:**
- **Vercel AI SDK:** Added support for new param `output_format`.
</Update>
<Update label="2025-05-08" description="v1.0.3">
**Improvements:**
- **Vercel AI SDK:** Added support for graceful failure in cases services are down.
</Update>
<Update label="2025-05-01" description="v1.0.1">
**New Features:**
- **Vercel AI SDK:** Added support for graph memories
</Update>
</Tab>
</Tabs>
+2
View File
@@ -4,6 +4,8 @@ icon: "gear"
iconType: "solid"
---
<Snippet file="paper-release.mdx" />
Config in mem0 is a dictionary that specifies the settings for your embedding models. It allows you to customize the behavior and connection details of your chosen embedder.
## How to define configurations?
@@ -0,0 +1,62 @@
---
title: AWS Bedrock
---
To use AWS Bedrock embedding models, you need to have the appropriate AWS credentials and permissions. The embeddings implementation relies on the `boto3` library.
### Setup
- Ensure you have model access from the [AWS Bedrock Console](https://us-east-1.console.aws.amazon.com/bedrock/home?region=us-east-1#/modelaccess)
- Authenticate the boto3 client using a method described in the [AWS documentation](https://boto3.amazonaws.com/v1/documentation/api/latest/guide/credentials.html)
- Set up environment variables for authentication:
```bash
export AWS_REGION=us-east-1
export AWS_ACCESS_KEY_ID=your-access-key
export AWS_SECRET_ACCESS_KEY=your-secret-key
```
### Usage
<CodeGroup>
```python Python
import os
from mem0 import Memory
# For LLM if needed
os.environ["OPENAI_API_KEY"] = "your-openai-api-key"
# AWS credentials
os.environ["AWS_REGION"] = "us-west-2"
os.environ["AWS_ACCESS_KEY_ID"] = "your-access-key"
os.environ["AWS_SECRET_ACCESS_KEY"] = "your-secret-key"
config = {
"embedder": {
"provider": "aws_bedrock",
"config": {
"model": "amazon.titan-embed-text-v2:0"
}
}
}
m = Memory.from_config(config)
messages = [
{"role": "user", "content": "I'm planning to watch a movie tonight. Any recommendations?"},
{"role": "assistant", "content": "How about a thriller movies? They can be quite engaging."},
{"role": "user", "content": "I'm not a big fan of thriller movies but I love sci-fi movies."},
{"role": "assistant", "content": "Got it! I'll avoid thriller recommendations and suggest sci-fi movies in the future."}
]
m.add(messages, user_id="alice")
```
</CodeGroup>
### Config
Here are the parameters available for configuring AWS Bedrock embedder:
<Tabs>
<Tab title="Python">
| Parameter | Description | Default Value |
| --- | --- | --- |
| `model` | The name of the embedding model to use | `amazon.titan-embed-text-v1` |
</Tab>
</Tabs>
@@ -25,12 +25,44 @@ m = Memory.from_config(config)
messages = [
{"role": "user", "content": "I'm planning to watch a movie tonight. Any recommendations?"},
{"role": "assistant", "content": "How about a thriller movies? They can be quite engaging."},
{"role": "user", "content": "I’m not a big fan of thriller movies but I love sci-fi movies."},
{"role": "user", "content": "I'm not a big fan of thriller movies but I love sci-fi movies."},
{"role": "assistant", "content": "Got it! I'll avoid thriller recommendations and suggest sci-fi movies in the future."}
]
m.add(messages, user_id="john")
```
### Using Text Embeddings Inference (TEI)
You can also use Hugging Face's Text Embeddings Inference service for faster and more efficient embeddings:
```python
import os
from mem0 import Memory
os.environ["OPENAI_API_KEY"] = "your_api_key" # For LLM
# Using HuggingFace Text Embeddings Inference API
config = {
"embedder": {
"provider": "huggingface",
"config": {
"huggingface_base_url": "http://localhost:3000/v1"
}
}
}
m = Memory.from_config(config)
m.add("This text will be embedded using the TEI service.", user_id="john")
```
To run the TEI service, you can use Docker:
```bash
docker run -d -p 3000:80 -v huggingfacetei:/data --platform linux/amd64 \
ghcr.io/huggingface/text-embeddings-inference:cpu-1.6 \
--model-id BAAI/bge-small-en-v1.5
```
### Config
Here are the parameters available for configuring Huggingface embedder:
@@ -39,4 +71,5 @@ Here are the parameters available for configuring Huggingface embedder:
| --- | --- | --- |
| `model` | The name of the model to use | `multi-qa-MiniLM-L6-cos-v1` |
| `embedding_dims` | Dimensions of the embedding model | `selected_model_dimensions` |
| `model_kwargs` | Additional arguments for the model | `None` |
| `model_kwargs` | Additional arguments for the model | `None` |
| `huggingface_base_url` | URL to connect to Text Embeddings Inference (TEI) API | `None` |
+3
View File
@@ -4,6 +4,8 @@ icon: "info"
iconType: "solid"
---
<Snippet file="paper-release.mdx" />
Mem0 offers support for various embedding models, allowing users to choose the one that best suits their needs.
## Supported Embedders
@@ -24,6 +26,7 @@ See the list of supported embedders below.
<Card title="Together" href="/components/embedders/models/together"></Card>
<Card title="LM Studio" href="/components/embedders/models/lmstudio"></Card>
<Card title="Langchain" href="/components/embedders/models/langchain"></Card>
<Card title="AWS Bedrock" href="/components/embedders/models/aws_bedrock"></Card>
</CardGroup>
## Usage
+2
View File
@@ -4,6 +4,8 @@ icon: "gear"
iconType: "solid"
---
<Snippet file="paper-release.mdx" />
## How to define configurations?
<Tabs>
@@ -2,6 +2,8 @@
title: Anthropic
---
<Snippet file="paper-release.mdx" />
To use anthropic's models, please set the `ANTHROPIC_API_KEY` which you find on their [Account Settings Page](https://console.anthropic.com/account/keys).
## Usage
+5 -4
View File
@@ -2,6 +2,8 @@
title: AWS Bedrock
---
<Snippet file="paper-release.mdx" />
### Setup
- Before using the AWS Bedrock LLM, make sure you have the appropriate model access from [Bedrock Console](https://us-east-1.console.aws.amazon.com/bedrock/home?region=us-east-1#/modelaccess).
- You will also need to authenticate the `boto3` client by using a method in the [AWS documentation](https://boto3.amazonaws.com/v1/documentation/api/latest/guide/credentials.html#configuring-credentials)
@@ -13,16 +15,15 @@ title: AWS Bedrock
import os
from mem0 import Memory
os.environ["OPENAI_API_KEY"] = "your-api-key" # used for embedding model
os.environ['AWS_REGION'] = 'us-east-1'
os.environ["AWS_ACCESS_KEY"] = "xx"
os.environ['AWS_REGION'] = 'us-west-2'
os.environ["AWS_ACCESS_KEY_ID"] = "xx"
os.environ["AWS_SECRET_ACCESS_KEY"] = "xx"
config = {
"llm": {
"provider": "aws_bedrock",
"config": {
"model": "arn:aws:bedrock:us-east-1:123456789012:model/your-model-name",
"model": "anthropic.claude-3-5-haiku-20241022-v1:0",
"temperature": 0.2,
"max_tokens": 2000,
}
@@ -2,6 +2,8 @@
title: Azure OpenAI
---
<Snippet file="paper-release.mdx" />
<Note> Mem0 Now Supports Azure OpenAI Models in TypeScript SDK </Note>
To use Azure OpenAI models, you have to set the `LLM_AZURE_OPENAI_API_KEY`, `LLM_AZURE_ENDPOINT`, `LLM_AZURE_DEPLOYMENT` and `LLM_AZURE_API_VERSION` environment variables. You can obtain the Azure API key from the [Azure](https://azure.microsoft.com/).
@@ -16,6 +18,8 @@ To use Azure OpenAI models, you have to set the `LLM_AZURE_OPENAI_API_KEY`, `LLM
import os
from mem0 import Memory
os.environ["OPENAI_API_KEY"] = "your-api-key" # used for embedding model
os.environ["LLM_AZURE_OPENAI_API_KEY"] = "your-api-key"
os.environ["LLM_AZURE_DEPLOYMENT"] = "your-deployment-name"
os.environ["LLM_AZURE_ENDPOINT"] = "your-api-base-url"
+2
View File
@@ -2,6 +2,8 @@
title: DeepSeek
---
<Snippet file="paper-release.mdx" />
To use DeepSeek LLM models, you have to set the `DEEPSEEK_API_KEY` environment variable. You can also optionally set `DEEPSEEK_API_BASE` if you need to use a different API endpoint (defaults to "https://api.deepseek.com").
## Usage
+2
View File
@@ -2,6 +2,8 @@
title: Gemini
---
<Snippet file="paper-release.mdx" />
To use Gemini model, you have to set the `GEMINI_API_KEY` environment variable. You can obtain the Gemini API key from the [Google AI Studio](https://aistudio.google.com/app/apikey)
## Usage
@@ -2,6 +2,8 @@
title: Google AI
---
<Snippet file="paper-release.mdx" />
To use Google AI model, you have to set the `GOOGLE_API_KEY` environment variable. You can obtain the Google API key from the [Google Maker Suite](https://makersuite.google.com/app/apikey)
## Usage
+2
View File
@@ -2,6 +2,8 @@
title: Groq
---
<Snippet file="paper-release.mdx" />
[Groq](https://groq.com/) is the creator of the world's first Language Processing Unit (LPU), providing exceptional speed performance for AI workloads running on their LPU Inference Engine.
In order to use LLMs from Groq, go to their [platform](https://console.groq.com/keys) and get the API key. Set the API key as `GROQ_API_KEY` environment variable to use the model as given below in the example.
@@ -2,6 +2,8 @@
title: LangChain
---
<Snippet file="paper-release.mdx" />
Mem0 supports LangChain as a provider to access a wide range of LLM models. LangChain is a framework for developing applications powered by language models, making it easy to integrate various LLM providers through a consistent interface.
For a complete list of available chat models supported by LangChain, refer to the [LangChain Chat Models documentation](https://python.langchain.com/docs/integrations/chat).
+2
View File
@@ -1,3 +1,5 @@
<Snippet file="paper-release.mdx" />
[Litellm](https://litellm.vercel.app/docs/) is compatible with over 100 large language models (LLMs), all using a standardized input/output format. You can explore the [available models](https://litellm.vercel.app/docs/providers) to use with Litellm. Ensure you set the `API_KEY` for the model you choose to use.
## Usage
+2
View File
@@ -2,6 +2,8 @@
title: LM Studio
---
<Snippet file="paper-release.mdx" />
To use LM Studio with Mem0, you'll need to have LM Studio running locally with its server enabled. LM Studio provides a way to run local LLMs with an OpenAI-compatible API.
## Usage
@@ -2,6 +2,8 @@
title: Mistral AI
---
<Snippet file="paper-release.mdx" />
To use mistral's models, please obtain the Mistral AI api key from their [console](https://console.mistral.ai/). Set the `MISTRAL_API_KEY` environment variable to use the model as given below in the example.
## Usage
+2
View File
@@ -1,3 +1,5 @@
<Snippet file="paper-release.mdx" />
You can use LLMs from Ollama to run Mem0 locally. These [models](https://ollama.com/search?c=tools) support tool support.
## Usage
+2
View File
@@ -2,6 +2,8 @@
title: OpenAI
---
<Snippet file="paper-release.mdx" />
To use OpenAI LLM models, you have to set the `OPENAI_API_KEY` environment variable. You can obtain the OpenAI API key from the [OpenAI Platform](https://platform.openai.com/account/api-keys).
## Usage
+2
View File
@@ -1,3 +1,5 @@
<Snippet file="paper-release.mdx" />
To use TogetherAI LLM models, you have to set the `TOGETHER_API_KEY` environment variable. You can obtain the TogetherAI API key from their [Account settings page](https://api.together.xyz/settings/api-keys).
## Usage
+2
View File
@@ -2,6 +2,8 @@
title: xAI
---
<Snippet file="paper-release.mdx" />
[xAI](https://x.ai/) is a new AI company founded by Elon Musk that develops large language models, including Grok. Grok is trained on real-time data from X (formerly Twitter) and aims to provide accurate, up-to-date responses with a touch of wit and humor.
In order to use LLMs from xAI, go to their [platform](https://console.x.ai) and get the API key. Set the API key as `XAI_API_KEY` environment variable to use the model as given below in the example.
+2
View File
@@ -4,6 +4,8 @@ icon: "info"
iconType: "solid"
---
<Snippet file="paper-release.mdx" />
Mem0 includes built-in support for various popular large language models. Memory can utilize the LLM provided by the user, ensuring efficient use for specific needs.
## Usage
+2
View File
@@ -4,6 +4,8 @@ icon: "gear"
iconType: "solid"
---
<Snippet file="paper-release.mdx" />
## How to define configurations?
The `config` is defined as an object with two main keys:
+38 -22
View File
@@ -1,59 +1,75 @@
[OpenSearch](https://opensearch.org/) is an open-source, enterprise-grade search and observability suite that brings order to unstructured data at scale. OpenSearch supports k-NN (k-Nearest Neighbors) and allows you to store and retrieve high-dimensional vector embeddings efficiently.
[OpenSearch](https://opensearch.org/) is an enterprise-grade search and observability suite that brings order to unstructured data at scale. OpenSearch supports k-NN (k-Nearest Neighbors) and allows you to store and retrieve high-dimensional vector embeddings efficiently.
### Installation
OpenSearch support requires additional dependencies. Install them with:
```bash
pip install opensearch>=2.8.0
pip install opensearch-py
```
### Prerequisites
Before using OpenSearch with Mem0, you need to set up a collection in AWS OpenSearch Service.
#### AWS OpenSearch Service
You can create a collection through the AWS Console:
- Navigate to [OpenSearch Service Console](https://console.aws.amazon.com/aos/home)
- Click "Create collection"
- Select "Serverless collection" and then enable "Vector search" capabilities
- Once created, note the endpoint URL (host) for your configuration
### Usage
```python
import os
from mem0 import Memory
import boto3
from opensearchpy import OpenSearch, RequestsHttpConnection, AWSV4SignerAuth
os.environ["OPENAI_API_KEY"] = "sk-xx"
# For AWS OpenSearch Service with IAM authentication
region = 'us-west-2'
service = 'aoss'
credentials = boto3.Session().get_credentials()
auth = AWSV4SignerAuth(credentials, region, service)
config = {
"vector_store": {
"provider": "opensearch",
"config": {
"collection_name": "mem0",
"host": "localhost",
"port": 9200,
"embedding_model_dims": 1536
"host": "your-domain.us-west-2.aoss.amazonaws.com",
"port": 443,
"http_auth": auth,
"embedding_model_dims": 1024,
"connection_class": RequestsHttpConnection,
"pool_maxsize": 20,
"use_ssl": True,
"verify_certs": True
}
}
}
```
### Add Memories
```python
m = Memory.from_config(config)
messages = [
{"role": "user", "content": "I'm planning to watch a movie tonight. Any recommendations?"},
{"role": "assistant", "content": "How about a thriller movies? They can be quite engaging."},
{"role": "user", "content": "I’m not a big fan of thriller movies but I love sci-fi movies."},
{"role": "user", "content": "I'm not a big fan of thriller movies but I love sci-fi movies."},
{"role": "assistant", "content": "Got it! I'll avoid thriller recommendations and suggest sci-fi movies in the future."}
]
m.add(messages, user_id="alice", metadata={"category": "movies"})
```
### Config
### Search Memories
Let's see the available parameters for the `opensearch` config:
| Parameter | Description | Default Value |
| ---------------------- | -------------------------------------------------- | ------------- |
| `collection_name` | The name of the index to store the vectors | `mem0` |
| `embedding_model_dims` | Dimensions of the embedding model | `1536` |
| `host` | The host where the OpenSearch server is running | `localhost` |
| `port` | The port where the OpenSearch server is running | `9200` |
| `api_key` | API key for authentication | `None` |
| `user` | Username for basic authentication | `None` |
| `password` | Password for basic authentication | `None` |
| `verify_certs` | Whether to verify SSL certificates | `False` |
| `auto_create_index` | Whether to automatically create the index | `True` |
| `use_ssl` | Whether to use SSL for connection | `False` |
```python
results = m.search("What kind of movies does Alice like?", user_id="alice")
```
### Features
+2
View File
@@ -4,6 +4,8 @@ icon: "info"
iconType: "solid"
---
<Snippet file="paper-release.mdx" />
Mem0 includes built-in support for various popular databases. Memory can utilize the database provided by the user, ensuring efficient use for specific needs.
## Supported Vector Databases
+2
View File
@@ -3,6 +3,8 @@ title: Development
icon: "code"
---
<Snippet file="paper-release.mdx" />
# Development Contributions
We strive to make contributions **easy, collaborative, and enjoyable**. Follow the steps below to ensure a smooth contribution process.
+2
View File
@@ -3,6 +3,8 @@ title: Documentation
icon: "book"
---
<Snippet file="paper-release.mdx" />
# Documentation Contributions
## 📌 Prerequisites
+2
View File
@@ -5,6 +5,8 @@ icon: "gear"
iconType: "solid"
---
<Snippet file="paper-release.mdx" />
Mem0 provides two core operations for managing memories in AI applications: adding new memories and searching existing ones. This guide covers how these operations work and how to use them effectively in your application.
+3
View File
@@ -4,6 +4,9 @@ description: Understanding different types of memory in AI Applications
icon: "memory"
iconType: "solid"
---
<Snippet file="paper-release.mdx" />
To build useful AI applications, we need to understand how different memory systems work together. This guide explores the fundamental types of memory in AI systems and shows how Mem0 implements these concepts.
## Why Memory Matters
+15 -2
View File
@@ -49,6 +49,7 @@
"features/advanced-retrieval",
"features/contextual-add",
"features/multimodal-support",
"features/timestamp",
"features/selective-memory",
"features/custom-categories",
"features/custom-instructions",
@@ -57,7 +58,8 @@
"features/memory-export",
"features/webhooks",
"features/graph-memory",
"features/feedback-mechanism"
"features/feedback-mechanism",
"features/expiration-date"
]
}
]
@@ -164,7 +166,8 @@
"components/embedders/models/gemini",
"components/embedders/models/lmstudio",
"components/embedders/models/together",
"components/embedders/models/langchain"
"components/embedders/models/langchain",
"components/embedders/models/aws_bedrock"
]
}
]
@@ -181,6 +184,14 @@
}
]
},
{
"tab": "OpenMemory",
"icon": "square-terminal",
"pages": [
"openmemory/overview",
"openmemory/quickstart"
]
},
{
"tab": "Examples",
"groups": [
@@ -189,8 +200,10 @@
"icon": "lightbulb",
"pages": [
"examples",
"examples/aws_example",
"examples/mem0-demo",
"examples/ai_companion_js",
"examples/eliza_os",
"examples/mem0-mastra",
"examples/mem0-with-ollama",
"examples/personal-ai-tutor",
+2
View File
@@ -3,6 +3,8 @@ title: Overview
description: How to use mem0 in your existing applications?
---
<Snippet file="paper-release.mdx" />
With Mem0, you can create stateful LLM-based applications such as chatbots, virtual assistants, or AI agents. Mem0 enhances your applications by providing a memory layer that makes responses:
+2
View File
@@ -2,6 +2,8 @@
title: AI Companion
---
<Snippet file="paper-release.mdx" />
You can create a personalised AI Companion using Mem0. This guide will walk you through the necessary steps and provide the complete code to get you started.
## Overview
+2
View File
@@ -2,6 +2,8 @@
title: AI Companion in Node.js
---
<Snippet file="paper-release.mdx" />
You can create a personalised AI Companion using Mem0. This guide will walk you through the necessary steps and provide the complete code to get you started.
## Overview
+120
View File
@@ -0,0 +1,120 @@
---
title: AWS Bedrock and AOSS
---
<Snippet file="paper-release.mdx" />
This example demonstrates how to configure and use the `mem0ai` SDK with **AWS Bedrock** and **OpenSearch Service (AOSS)** for persistent memory capabilities in Python.
## Installation
Install the required dependencies:
```bash
pip install mem0ai boto3 opensearch-py
```
## Environment Setup
Set your AWS environment variables:
```python
import os
# Set these in your environment or notebook
os.environ['AWS_REGION'] = 'us-west-2'
os.environ['AWS_ACCESS_KEY_ID'] = 'AK00000000000000000'
os.environ['AWS_SECRET_ACCESS_KEY'] = 'AS00000000000000000'
# Confirm they are set
print(os.environ['AWS_REGION'])
print(os.environ['AWS_ACCESS_KEY_ID'])
print(os.environ['AWS_SECRET_ACCESS_KEY'])
```
## Configuration and Usage
This sets up Mem0 with AWS Bedrock for embeddings and LLM, and OpenSearch as the vector store.
```python
import boto3
from opensearchpy import OpenSearch, RequestsHttpConnection, AWSV4SignerAuth
from mem0.memory.main import Memory
region = 'us-west-2'
service = 'aoss'
credentials = boto3.Session().get_credentials()
auth = AWSV4SignerAuth(credentials, region, service)
config = {
"embedder": {
"provider": "aws_bedrock",
"config": {
"model": "amazon.titan-embed-text-v2:0"
}
},
"llm": {
"provider": "aws_bedrock",
"config": {
"model": "anthropic.claude-3-5-haiku-20241022-v1:0",
"temperature": 0.1,
"max_tokens": 2000
}
},
"vector_store": {
"provider": "opensearch",
"config": {
"collection_name": "mem0",
"host": "your-opensearch-domain.us-west-2.es.amazonaws.com",
"port": 443,
"http_auth": auth,
"embedding_model_dims": 1024,
"connection_class": RequestsHttpConnection,
"pool_maxsize": 20,
"use_ssl": True,
"verify_certs": True
}
}
}
# Initialize memory system
m = Memory.from_config(config)
```
## Usage
#### Add a memory:
```python
messages = [
{"role": "user", "content": "I'm planning to watch a movie tonight. Any recommendations?"},
{"role": "assistant", "content": "How about a thriller movies? They can be quite engaging."},
{"role": "user", "content": "I'm not a big fan of thriller movies but I love sci-fi movies."},
{"role": "assistant", "content": "Got it! I'll avoid thriller recommendations and suggest sci-fi movies in the future."}
]
# Store inferred memories (default behavior)
result = m.add(messages, user_id="alice", metadata={"category": "movie_recommendations"})
```
#### Search a memory:
```python
relevant_memories = m.search(query, user_id="alice")
```
#### Get all memories:
```python
all_memories = m.get_all(user_id="alice")
```
#### Get a specific memory:
```python
memory = m.get(memory_id)
```
---
## Conclusion
With Mem0 and AWS services like Bedrock and OpenSearch, you can build intelligent AI companions that remember, adapt, and personalize their responses over time. This makes them ideal for long-term assistants, tutors, or support bots with persistent memory and natural conversation abilities.
+2
View File
@@ -1,5 +1,7 @@
# Mem0 Chrome Extension
<Snippet file="paper-release.mdx" />
Enhance your AI interactions with **Mem0**, a Chrome extension that introduces a universal memory layer across platforms like `ChatGPT`, `Claude`, and `Perplexity`. Mem0 ensures seamless context sharing, making your AI experiences more personalized and efficient.
<Note>
+2
View File
@@ -2,6 +2,8 @@
title: Customer Support AI Agent
---
<Snippet file="paper-release.mdx" />
You can create a personalized Customer Support AI Agent using Mem0. This guide will walk you through the necessary steps and provide the complete code to get you started.
## Overview
+1
View File
@@ -1,6 +1,7 @@
---
title: Document Editing with Mem0
---
<Snippet file="paper-release.mdx" />
This guide demonstrates how to leverage **Mem0** to edit documents efficiently, ensuring they align with your unique writing style and preferences.
+75
View File
@@ -0,0 +1,75 @@
---
title: Eliza OS Character
---
<Snippet file="paper-release.mdx" />
You can create a personalised Eliza OS Character using Mem0. This guide will walk you through the necessary steps and provide the complete code to get you started.
## Overview
ElizaOS is a powerful AI agent framework for autonomy & personality. It is a collection of tools that help you create a personalised AI agent.
## Setup
You can start by cloning the eliza-os repository:
```bash
git clone https://github.com/elizaOS/eliza.git
```
Change the directory to the eliza-os repository:
```bash
cd eliza
```
Install the dependencies:
```bash
pnpm install
```
Build the project:
```bash
pnpm build
```
## Setup ENVs
Create a `.env` file in the root of the project and add the following ( You can use the `.env.example` file as a reference):
```bash
# Mem0 Configuration
MEM0_API_KEY= # Mem0 API Key ( Get from https://app.mem0.ai/dashboard/api-keys )
MEM0_USER_ID= # Default: eliza-os-user
MEM0_PROVIDER= # Default: openai
MEM0_PROVIDER_API_KEY= # API Key for the provider (openai, anthropic, etc.)
SMALL_MEM0_MODEL= # Default: gpt-4o-mini
MEDIUM_MEM0_MODEL= # Default: gpt-4o
LARGE_MEM0_MODEL= # Default: gpt-4o
```
## Make the default character use Mem0
By default, there is a character called `eliza` that uses the `ollama` model. You can make this character use Mem0 by changing the config in the `agent/src/defaultCharacter.ts` file.
```ts
modelProvider: ModelProviderName.MEM0,
```
This will make the character use Mem0 to generate responses.
## Run the project
```bash
pnpm start
```
## Conclusion
You have now created a personalised Eliza OS Character using Mem0. You can now start interacting with the character by running the project and talking to the character.
This is a simple example of how to use Mem0 to create a personalised AI agent. You can use this as a starting point to create your own AI agent.
+2
View File
@@ -2,6 +2,8 @@
title: Email Processing with Mem0
---
<Snippet file="paper-release.mdx" />
This guide demonstrates how to build an intelligent email processing system using Mem0's memory capabilities. You'll learn how to store, categorize, retrieve, and analyze emails to create a smart email management solution.
## Overview
+2
View File
@@ -1,6 +1,8 @@
---
title: LlamaIndex ReAct Agent
---
<Snippet file="paper-release.mdx" />
Create a ReAct Agent with LlamaIndex which uses Mem0 as the memory store.
### Overview
+2
View File
@@ -2,6 +2,8 @@
title: Mem0 as an Agentic Tool
---
<Snippet file="paper-release.mdx" />
Integrate Mem0's memory capabilities with OpenAI's Agents SDK to create AI agents with persistent memory.
You can create agents that remember past conversations and use that context to provide better responses.
+4 -1
View File
@@ -2,6 +2,9 @@
title: Mem0 Demo
---
<Snippet file="paper-release.mdx" />
You can create a personalized AI Companion using Mem0. This guide will walk you through the necessary steps and provide the complete setup instructions to get you started.
<video
@@ -13,7 +16,7 @@ You can create a personalized AI Companion using Mem0. This guide will walk you
src="https://github.com/user-attachments/assets/cebc4f8e-bdb9-4837-868d-13c5ab7bb433"
></video>
You can try the [Mem0 Demo](https://mem0.dev/demo) live here.
You can try the [Mem0 Demo](https://mem0-4vmi.vercel.app) live here.
## Overview
+2
View File
@@ -2,6 +2,8 @@
title: Mem0 with Mastra
---
<Snippet file="paper-release.mdx" />
In this example you'll learn how to use the Mem0 to add long-term memory capabilities to [Mastra's agent](https://mastra.ai/) via tool-use.
This memory integration can work alongside Mastra's [agent memory features](https://mastra.ai/docs/agents/01-agent-memory).
+2
View File
@@ -3,6 +3,8 @@ title: 'Mem0 with OpenAI Agents SDK for Voice'
description: 'Integrate memory capabilities into your voice agents using Mem0 and OpenAI Agents SDK'
---
<Snippet file="paper-release.mdx" />
# Building Voice Agents with Memory using Mem0 and OpenAI Agents SDK
This guide demonstrates how to combine OpenAI's Agents SDK for voice applications with Mem0's memory capabilities to create a voice assistant that remembers user preferences and past interactions.
+2
View File
@@ -2,6 +2,8 @@
title: Mem0 with Ollama
---
<Snippet file="paper-release.mdx" />
## Running Mem0 Locally with Ollama
Mem0 can be utilized entirely locally by leveraging Ollama for both the embedding model and the language model (LLM). This guide will walk you through the necessary steps and provide the complete code to get you started.
+2
View File
@@ -2,6 +2,8 @@
title: Multimodal Demo with Mem0
---
<Snippet file="paper-release.mdx" />
Enhance your AI interactions with **Mem0**'s multimodal capabilities. Mem0 now supports image understanding, allowing for richer context and more natural interactions across supported AI platforms.
> 🎉 Experience the power of multimodal AI! Test out Mem0's image understanding capabilities at [multimodal-demo.mem0.ai](https://multimodal-demo.mem0.ai)
+2
View File
@@ -2,6 +2,8 @@
title: OpenAI Inbuilt Tools
---
<Snippet file="paper-release.mdx" />
Integrate Mem0’s memory capabilities with OpenAI’s Inbuilt Tools to create AI agents with persistent memory.
## Getting Started
+2
View File
@@ -2,6 +2,8 @@
title: Personalized AI Tutor
---
<Snippet file="paper-release.mdx" />
You can create a personalized AI Tutor using Mem0. This guide will walk you through the necessary steps and provide the complete code to get you started.
## Overview
@@ -1,6 +1,9 @@
---
title: Personal AI Travel Assistant
---
<Snippet file="paper-release.mdx" />
Create a personalized AI Travel Assistant using Mem0. This guide provides step-by-step instructions and the complete code to get you started.
## Overview
@@ -2,6 +2,8 @@
title: Personalized Deep Research
---
<Snippet file="paper-release.mdx" />
Deep Research is an intelligent agent that synthesizes large amounts of online data and completes complex research tasks, customized to your unique preferences and insights. Built on Mem0's technology, it enhances AI-driven online exploration with personalized memories.
## Overview
+2
View File
@@ -2,6 +2,8 @@
title: YouTube Assistant Extension
---
<Snippet file="paper-release.mdx" />
Enhance your YouTube experience with Mem0's **YouTube Assistant**, a Chrome extension that brings AI-powered chat directly to your YouTube videos. Get instant, personalized answers about video content while leveraging your own knowledge and memories - all without leaving the page.
## Features
+1
View File
@@ -4,6 +4,7 @@ icon: "question"
iconType: "solid"
---
<Snippet file="paper-release.mdx" />
<AccordionGroup>
<Accordion title="How does Mem0 work?">
+2
View File
@@ -4,6 +4,8 @@ icon: "wrench"
iconType: "solid"
---
<Snippet file="paper-release.mdx" />
## Core features
- **User, Session, and AI Agent Memory**: Retains information across sessions and interactions for users and AI agents, ensuring continuity and context.
+2
View File
@@ -4,6 +4,8 @@ icon: "magnifying-glass"
iconType: "solid"
---
<Snippet file="paper-release.mdx" />
Mem0's **Advanced Retrieval** feature delivers superior search results by leveraging state-of-the-art search algorithms. Beyond the default search functionality, Mem0 offers the following advanced retrieval modes:
1. **Keyword Search**
+1
View File
@@ -5,6 +5,7 @@ icon: "bolt"
iconType: "solid"
---
<Snippet file="paper-release.mdx" />
The `AsyncMemoryClient` is an asynchronous client for interacting with the Mem0 API. It provides similar functionality to the synchronous `MemoryClient` but allows for non-blocking operations, which can be beneficial in applications that require high concurrency.
## Initialization
+2
View File
@@ -4,6 +4,8 @@ icon: "square-plus"
iconType: "solid"
---
<Snippet file="paper-release.mdx" />
Mem0 now supports an contextual add version (v2). To use it, set `version="v2"` during the add call. The default version is v1, which is deprecated now. We recommend migrating to `v2` for new applications.
## Key Differences Between v1 and v2
+2
View File
@@ -5,6 +5,8 @@ icon: "tags"
iconType: "solid"
---
<Snippet file="paper-release.mdx" />
## How to set custom categories?
You can now create custom categories tailored to your specific needs, instead of using the default categories such as travel, sports, music, and more (see [default categories](#default-categories) below). **When custom categories are provided, they will override the default categories.**
@@ -5,6 +5,8 @@ icon: "pencil"
iconType: "solid"
---
<Snippet file="paper-release.mdx" />
## Introduction to Custom Fact Extraction Prompt
Custom fact extraction prompt allow you to tailor the behavior of your Mem0 instance to specific use cases or domains.
+2
View File
@@ -5,6 +5,8 @@ icon: "pencil"
iconType: "solid"
---
<Snippet file="paper-release.mdx" />
## Introduction to Custom Instructions
Custom instructions allow you to define specific guidelines for your project. This feature helps ensure consistency and provides clear direction for handling project-specific requirements.
@@ -3,9 +3,12 @@ title: Custom Update Memory Prompt
icon: "pencil"
iconType: "solid"
---
<Snippet file="paper-release.mdx" />
Update memory prompt is a prompt used to determine the action to be performed on the memory.
By customizing this prompt, you can control how the memory is updated.
## Introduction
Mem0 memory system compares the newly retrieved facts with the existing memory and determines the action to be performed on the memory.
+2
View File
@@ -5,6 +5,8 @@ icon: "arrow-right"
iconType: "solid"
---
<Snippet file="paper-release.mdx" />
## How to use Direct Import?
The Direct Import feature allows users to skip the memory deduction phase and directly input pre-defined memories into the system for storage and retrieval.
To enable this feature, you need to set the `infer` parameter to `False` in the `add` method.
+114
View File
@@ -0,0 +1,114 @@
---
title: Expiration Date
description: 'Set time-bound memories in Mem0 with automatic expiration dates to manage temporal information effectively.'
icon: "clock"
iconType: "solid"
---
<Snippet file="paper-release.mdx" />
## Benefits of Memory Expiration
Setting expiration dates for memories offers several advantages:
• **Time-Sensitive Information Management**: Handle information that's only relevant for a specific time period.
• **Event-Based Memory**: Manage information related to upcoming events that becomes irrelevant after the event passes.
These benefits enable more sophisticated memory management for applications where temporal context matters.
## Setting Memory Expiration Date
You can set an expiration date for memories, after which they will no longer be retrieved in searches. This is useful for creating temporary memories or memories that are only relevant for a specific time period.
<CodeGroup>
```python Python
import datetime
from mem0 import MemoryClient
client = MemoryClient(api_key="your-api-key")
messages = [
{
"role": "user",
"content": "I'll be in San Francisco until end of this month."
}
]
# Set an expiration date for this memory
client.add(messages=messages, user_id="alex", expiration_date=str(datetime.datetime.now().date() + datetime.timedelta(days=30)))
# You can also use an explicit date string
client.add(messages=messages, user_id="alex", expiration_date="2023-08-31")
```
```javascript JavaScript
import MemoryClient from 'mem0ai';
const client = new MemoryClient({ apiKey: 'your-api-key' });
const messages = [
{
"role": "user",
"content": "I'll be in San Francisco until end of this month."
}
];
// Set an expiration date 30 days from now
const expirationDate = new Date();
expirationDate.setDate(expirationDate.getDate() + 30);
client.add(messages, {
user_id: "alex",
expiration_date: expirationDate.toISOString().split('T')[0]
})
.then(response => console.log(response))
.catch(error => console.error(error));
// You can also use an explicit date string
client.add(messages, {
user_id: "alex",
expiration_date: "2023-08-31"
})
.then(response => console.log(response))
.catch(error => console.error(error));
```
```bash cURL
curl -X POST "https://api.mem0.ai/v1/memories/" \
-H "Authorization: Token your-api-key" \
-H "Content-Type: application/json" \
-d '{
"messages": [
{
"role": "user",
"content": "I'll be in San Francisco until end of this month."
}
],
"user_id": "alex",
"expiration_date": "2023-08-31"
}'
```
```json Output
{
"results": [
{
"id": "a1b2c3d4-e5f6-4g7h-8i9j-k0l1m2n3o4p5",
"data": {
"memory": "In San Francisco until end of this month"
},
"event": "ADD"
}
]
}
```
</CodeGroup>
<Note>
Once a memory reaches its expiration date, it won't be included in search or get results, though the data remains stored in the system.
</Note>
If you have any questions, please feel free to reach out to us using one of the following methods:
<Snippet file="get-help.mdx" />
+2
View File
@@ -4,6 +4,8 @@ icon: "thumbs-up"
iconType: "solid"
---
<Snippet file="paper-release.mdx" />
Mem0's **Feedback Mechanism** allows you to provide feedback on the memories generated by your application. This feedback is used to improve the accuracy of the memories and the search results.
## How it works
+13 -11
View File
@@ -5,6 +5,8 @@ iconType: "solid"
description: "Enable graph-based memory retrieval for more contextually relevant results"
---
<Snippet file="paper-release.mdx" />
## Overview
Graph Memory enhances memory pipeline by creating relationships between entities in your data. It builds a network of interconnected information for more contextually relevant search results.
@@ -59,8 +61,8 @@ import { MemoryClient } from "mem0";
const client = new MemoryClient({
apiKey: "your-api-key",
orgId: "your-org-id",
projectId: "your-project-id"
org_id: "your-org-id",
project_id: "your-project-id"
});
const messages = [
@@ -72,10 +74,10 @@ const messages = [
// Enable graph memory when adding
await client.add({
messages,
userId: "joseph",
user_id: "joseph",
version: "v1",
enableGraph: true,
outputFormat: "v1.1"
enable_graph: true,
output_format: "v1.1"
});
```
@@ -140,9 +142,9 @@ print(results)
// Search with graph memory enabled
const results = await client.search({
query: "what is my name?",
userId: "joseph",
enableGraph: true,
outputFormat: "v1.1"
user_id: "joseph",
enable_graph: true,
output_format: "v1.1"
});
console.log(results);
@@ -209,9 +211,9 @@ print(memories)
```javascript JavaScript
// Get all memories with graph context
const memories = await client.getAll({
userId: "joseph",
enableGraph: true,
outputFormat: "v1.1"
user_id: "joseph",
enable_graph: true,
output_format: "v1.1"
});
console.log(memories);
+2
View File
@@ -5,6 +5,8 @@ icon: "file-export"
iconType: "solid"
---
<Snippet file="paper-release.mdx" />
## Overview
The Memory Export feature allows you to create structured exports of memories using customizable Pydantic schemas. This process enables you to transform your stored memories into specific data formats that match your needs. You can apply various filters to narrow down which memories to export and define exactly how the data should be structured.
+2
View File
@@ -5,6 +5,8 @@ icon: "image"
iconType: "solid"
---
<Snippet file="paper-release.mdx" />
Mem0 extends its capabilities beyond text by supporting multimodal data, including images and documents. With this feature, users can seamlessly integrate visual and document content into their interactions—allowing Mem0 to extract relevant information from various media types and enrich the memory system.
## How It Works
+2
View File
@@ -4,6 +4,8 @@ icon: "code"
iconType: "solid"
---
<Snippet file="paper-release.mdx" />
Mem0 can be easily integrated into chat applications to enhance conversational agents with structured memory. Mem0's APIs are designed to be compatible with OpenAI's, with the goal of making it easy to leverage Mem0 in applications you may have already built.
If you have a `Mem0 API key`, you can use it to initialize the client. Alternatively, you can initialize Mem0 without an API key if you're using it locally.
+2
View File
@@ -4,6 +4,8 @@ icon: "info"
iconType: "solid"
---
<Snippet file="paper-release.mdx" />
Learn about the key features and capabilities that make Mem0 a powerful platform for memory management and retrieval.
## Core Features
+2
View File
@@ -5,6 +5,8 @@ icon: "filter"
iconType: "solid"
---
<Snippet file="paper-release.mdx" />
## Benefits of Memory Customization
Memory customization offers several key benefits:
+138
View File
@@ -0,0 +1,138 @@
---
title: Memory Timestamps
description: 'Add timestamps to your memories to maintain chronological accuracy and historical context'
icon: "clock"
iconType: "solid"
---
<Snippet file="paper-release.mdx" />
## Overview
The Memory Timestamps feature allows you to specify when a memory was created, regardless of when it's actually added to the system. This powerful capability enables you to:
- Maintain accurate chronological ordering of memories
- Import historical data with proper timestamps
- Create memories that reflect when events actually occurred
- Build timelines with precise temporal information
By leveraging custom timestamps, you can ensure that your memory system maintains an accurate representation of when information was generated or events occurred.
## Benefits of Custom Timestamps
Custom timestamps offer several important benefits:
• **Historical Accuracy**: Preserve the exact timing of past events and information.
• **Data Migration**: Seamlessly migrate existing data while maintaining original timestamps.
• **Time-Sensitive Analysis**: Enable time-based analysis and pattern recognition across memories.
• **Consistent Chronology**: Maintain proper ordering of memories for coherent storytelling.
## Using Custom Timestamps
When adding new memories, you can specify a custom timestamp to indicate when the memory was created. This timestamp will be used instead of the current time.
### Adding Memories with Custom Timestamps
<CodeGroup>
```python Python
import os
import time
from datetime import datetime, timedelta
from mem0 import MemoryClient
os.environ["MEM0_API_KEY"] = "your-api-key"
client = MemoryClient()
# Get the current time
current_time = datetime.now()
# Calculate 5 days ago
five_days_ago = current_time - timedelta(days=5)
# Convert to Unix timestamp (seconds since epoch)
unix_timestamp = int(five_days_ago.timestamp())
# Add memory with custom timestamp
client.add("I'm travelling to SF", user_id="user1", timestamp=unix_timestamp)
```
```javascript JavaScript
import MemoryClient from 'mem0ai';
const client = new MemoryClient({ apiKey: 'your-api-key' });
// Get the current time
const currentTime = new Date();
// Calculate 5 days ago
const fiveDaysAgo = new Date();
fiveDaysAgo.setDate(currentTime.getDate() - 5);
// Convert to Unix timestamp (seconds since epoch)
const unixTimestamp = Math.floor(fiveDaysAgo.getTime() / 1000);
// Add memory with custom timestamp
client.add("I'm travelling to SF", { user_id: "user1", timestamp: unixTimestamp })
.then(response => console.log(response))
.catch(error => console.error(error));
```
```bash cURL
curl -X POST "https://api.mem0.ai/v1/memories/" \
-H "Authorization: Token your-api-key" \
-H "Content-Type: application/json" \
-d '{
"messages": [{"role": "user", "content": "I'm travelling to SF"}],
"user_id": "user1",
"timestamp": 1721577600
}'
```
```json Output
{
"results": [
{
"id": "a1b2c3d4-e5f6-4g7h-8i9j-k0l1m2n3o4p5",
"data": {"memory": "Travelling to SF"},
"event": "ADD"
}
]
}
```
</CodeGroup>
### Timestamp Format
When specifying a custom timestamp, you should provide a Unix timestamp (seconds since epoch). This is an integer representing the number of seconds that have elapsed since January 1, 1970 (UTC).
For example, to create a memory with a timestamp of January 1, 2023:
<CodeGroup>
```python Python
# January 1, 2023 timestamp
january_2023_timestamp = 1672531200 # Unix timestamp for 2023-01-01 00:00:00 UTC
client.add("Important historical information", user_id="user1", timestamp=january_2023_timestamp)
```
```javascript JavaScript
// January 1, 2023 timestamp
const january2023Timestamp = 1672531200; // Unix timestamp for 2023-01-01 00:00:00 UTC
client.add("Important historical information", { user_id: "user1", timestamp: january2023Timestamp })
.then(response => console.log(response))
.catch(error => console.error(error));
```
</CodeGroup>
If you have any questions, please feel free to reach out to us using one of the following methods:
<Snippet file="get-help.mdx" />
+2
View File
@@ -5,6 +5,8 @@ icon: "webhook"
iconType: "solid"
---
<Snippet file="paper-release.mdx" />
## Overview
Webhooks enable real-time notifications for memory events in your Mem0 project. Webhooks are configured at the project level, meaning each webhook is tied to a specific project and receives events solely from that project. You can configure webhooks to send HTTP POST requests to your specified URLs whenever memories are created, updated, or deleted.
+2
View File
@@ -3,6 +3,8 @@ title: Overview
description: How to integrate Mem0 into other frameworks
---
<Snippet file="paper-release.mdx" />
Mem0 seamlessly integrates with popular AI frameworks and tools to enhance your LLM-based applications with persistent memory capabilities. By integrating Mem0, your applications benefit from:
- Enhanced context management across multiple frameworks
+2 -1
View File
@@ -1,8 +1,9 @@
---
title: Agno
---
<Snippet file="paper-release.mdx" />
Integrate [**Mem0**](https://github.com/mem0ai/mem0) with [Agno](https://github.com/agno-ai/agno), a Python framework for building autonomous agents. This integration enables Agno agents to access persistent memory across conversations, enhancing context retention and personalization.
Integrate [**Mem0**](https://github.com/mem0ai/mem0) with [Agno](https://github.com/agno-agi/agno), a Python framework for building autonomous agents. This integration enables Agno agents to access persistent memory across conversations, enhancing context retention and personalization.
## Overview
+2
View File
@@ -1,5 +1,7 @@
Build conversational AI agents with memory capabilities. This integration combines AutoGen for creating AI agents with Mem0 for memory management, enabling context-aware and personalized interactions.
<Snippet file="paper-release.mdx" />
## Overview
In this guide, we'll explore an example of creating a conversational AI system with memory:
+2
View File
@@ -2,6 +2,8 @@
title: CrewAI
---
<Snippet file="paper-release.mdx" />
Build an AI system that combines CrewAI's agent-based architecture with Mem0's memory capabilities. This integration enables persistent memory across agent interactions and personalized task execution based on user history.
## Overview
+2
View File
@@ -2,6 +2,8 @@
title: Dify
---
<Snippet file="paper-release.mdx" />
# Integrating Mem0 with Dify AI
Mem0 brings a robust memory layer to Dify AI, empowering your AI agents with persistent conversation storage and retrieval capabilities. With Mem0, your Dify applications gain the ability to recall past interactions and maintain context, ensuring more natural and insightful conversations.
+2
View File
@@ -2,6 +2,8 @@
title: ElevenLabs
---
<Snippet file="paper-release.mdx" />
Create voice-based conversational AI agents with memory capabilities by integrating ElevenLabs and Mem0. This integration enables persistent, context-aware voice interactions that remember past conversations.
## Overview
+2
View File
@@ -2,6 +2,8 @@
title: Flowise
---
<Snippet file="paper-release.mdx" />
The [**Mem0 Memory**](https://github.com/mem0ai/mem0) integration with [Flowise](https://github.com/FlowiseAI/Flowise) enables persistent memory capabilities for your AI chatflows. [Flowise](https://flowiseai.com/) is an open-source low-code tool for developers to build customized LLM orchestration flows & AI agents using a drag & drop interface.
## Overview
+2
View File
@@ -2,6 +2,8 @@
title: Keywords AI
---
<Snippet file="paper-release.mdx" />
Build AI applications with persistent memory and comprehensive LLM observability by integrating Mem0 with Keywords AI.
## Overview
+2
View File
@@ -3,6 +3,8 @@ title: Langchain Tools
description: 'Integrate Mem0 with LangChain tools to enable AI agents to store, search, and manage memories through structured interfaces'
---
<Snippet file="paper-release.mdx" />
## Overview
Mem0 provides a suite of tools for storing, searching, and retrieving memories, enabling agents to maintain context and learn from past interactions. The tools are built as Langchain tools, making them easily integrable with any AI agent implementation.
+2
View File
@@ -2,6 +2,8 @@
title: Langchain
---
<Snippet file="paper-release.mdx" />
Build a personalized Travel Agent AI using LangChain for conversation flow and Mem0 for memory retention. This integration enables context-aware and efficient travel planning experiences.
## Overview
+2
View File
@@ -2,6 +2,8 @@
title: LangGraph
---
<Snippet file="paper-release.mdx" />
Build a personalized Customer Support AI Agent using LangGraph for conversation flow and Mem0 for memory retention. This integration enables context-aware and efficient support experiences.
## Overview
+2
View File
@@ -2,6 +2,8 @@
title: Livekit
---
<Snippet file="paper-release.mdx" />
This guide demonstrates how to create a memory-enabled voice assistant using LiveKit, Deepgram, OpenAI, and Mem0, focusing on creating an intelligent, context-aware travel planning agent.
## Prerequisites
+2
View File
@@ -2,6 +2,8 @@
title: LlamaIndex
---
<Snippet file="paper-release.mdx" />
LlamaIndex supports Mem0 as a [memory store](https://llamahub.ai/l/memory/llama-index-memory-mem0). In this guide, we'll show you how to use it.
<Note type="info">
+2
View File
@@ -2,6 +2,8 @@
title: MCP Server
---
<Snippet file="paper-release.mdx" />
## Integrating mem0 as an MCP Server in Cursor
[mem0](https://github.com/mem0ai/mem0-mcp) is a powerful tool designed to enhance AI-driven workflows, particularly in code generation and contextual memory. In this guide, we'll walk through integrating mem0 as an **MCP (Model Context Protocol) server** within [Cursor](https://cursor.sh/), an AI-powered coding editor.
+2
View File
@@ -2,6 +2,8 @@
title: MultiOn
---
<Snippet file="paper-release.mdx" />
Build a personal browser agent that remembers user preferences and automates web tasks. It integrates Mem0 for memory management with MultiOn for executing browser actions, enabling personalized and efficient web interactions.
## Overview
+2
View File
@@ -3,6 +3,8 @@ title: 'Pipecat'
description: 'Integrate Mem0 with Pipecat for conversational memory in AI agents'
---
<Snippet file="paper-release.mdx" />
# Pipecat Integration
Mem0 seamlessly integrates with [Pipecat](https://pipecat.ai), providing long-term memory capabilities for conversational AI agents. This integration allows your Pipecat-powered applications to remember past conversations and provide personalized responses based on user history.
+23 -1
View File
@@ -2,10 +2,12 @@
title: Vercel AI SDK
---
<Snippet file="paper-release.mdx" />
The [**Mem0 AI SDK Provider**](https://www.npmjs.com/package/@mem0/vercel-ai-provider) is a library developed by **Mem0** to integrate with the Vercel AI SDK. This library brings enhanced AI interaction capabilities to your applications by introducing persistent memory functionality.
<Note type="info">
🎉 Exciting news! Mem0 AI SDK now supports <strong>Tools Call</strong>.
🎉 Exciting news! Mem0 AI SDK now supports <strong>Graph Memory</strong>.
</Note>
## Overview
@@ -79,6 +81,8 @@ npm install @mem0/vercel-ai-provider
> `getMemories` will return raw memories in the form of an array of objects, while `retrieveMemories` will return a response in string format with a system prompt ingested with the retrieved memories.
> `getMemories` is an object with two keys: `results` and `relations` if `enable_graph` is enabled. Otherwise, it will return an array of objects.
### 1. Basic Text Generation with Memory Context
```typescript
@@ -203,6 +207,24 @@ console.log(sources);
The same can be done for `streamText` as well.
## Graph Memory
Mem0 AI SDK now supports Graph Memory. You can enable it by setting `enable_graph` to `true` in the `mem0Config` object.
```typescript
const mem0 = createMem0({
mem0Config: { enable_graph: true },
});
```
You can also pass `enable_graph` in the standalone functions. This includes `getMemories`, `retrieveMemories`, and `addMemories`.
```typescript
const memories = await getMemories(prompt, { user_id: "borat", mem0ApiKey: "m0-xxx", enable_graph: true });
```
The `getMemories` function will return an object with two keys: `results` and `relations`, if `enable_graph` is set to `true`. Otherwise, it will return an array of objects.
## Key Features
@@ -5,6 +5,8 @@ icon: "list-check"
iconType: "solid"
---
<Snippet file="paper-release.mdx" />
Graph Memory is a powerful feature that allows users to create and utilize complex relationships between pieces of information.
## Graph Memory supports the following features:
+71 -2
View File
@@ -5,6 +5,8 @@ icon: "database"
iconType: "solid"
---
<Snippet file="paper-release.mdx" />
Mem0 now supports **Graph Memory**.
With Graph Memory, users can now create and utilize complex relationships between pieces of information, allowing for more nuanced and context-aware responses.
This integration enables users to leverage the strengths of both vector-based and graph-based approaches, resulting in more accurate and comprehensive information retrieval and generation.
@@ -47,8 +49,14 @@ allowfullscreen
## Initialize Graph Memory
To initialize Graph Memory you'll need to set up your configuration with graph store providers.
Currently, we support Neo4j as a graph store provider. You can setup [Neo4j](https://neo4j.com/) locally or use the hosted [Neo4j AuraDB](https://neo4j.com/product/auradb/).
To initialize Graph Memory you'll need to set up your configuration with graph
store providers. Currently, we support [Neo4j](#initialize-neo4j) and
[Memgraph](#initialize-memgraph) as graph store providers.
### Initialize Neo4j
You can setup [Neo4j](https://neo4j.com/) locally or use the hosted [Neo4j AuraDB](https://neo4j.com/product/auradb/).
<Note>If you are using Neo4j locally, then you need to install [APOC plugins](https://neo4j.com/labs/apoc/4.1/installation/).</Note>
@@ -163,6 +171,67 @@ const memory = new Memory(config);
If you are using NodeSDK, you need to pass `enableGraph` as `true` in the `config` object.
</Note>
### Initialize Memgraph
Run Memgraph with Docker:
```bash
docker run -p 7687:7687 memgraph/memgraph-mage:latest --schema-info-enabled=True
```
The `--schema-info-enabled` flag is set to `True` for more performant schema
generation.
Additional information can be found on [Memgraph
documentation](https://memgraph.com/docs).
User can also customize the LLM for Graph Memory from the [Supported LLM list](https://docs.mem0.ai/components/llms/overview) with three levels of configuration:
1. **Main Configuration**: If `llm` is set in the main config, it will be used for all graph operations.
2. **Graph Store Configuration**: If `llm` is set in the graph_store config, it will override the main config `llm` and be used specifically for graph operations.
3. **Default Configuration**: If no custom LLM is set, the default LLM (`gpt-4o-2024-08-06`) will be used for all graph operations.
Here's how you can do it:
<CodeGroup>
```python Python
from mem0 import Memory
config = {
"graph_store": {
"provider": "memgraph",
"config": {
"url": "bolt://localhost:7687",
"username": "memgraph",
"password": "xxx",
},
},
}
m = Memory.from_config(config_dict=config)
```
```python Python (Advanced)
config = {
"embedder": {
"provider": "openai",
"config": {"model": "text-embedding-3-large", "embedding_dims": 1536},
},
"graph_store": {
"provider": "memgraph",
"config": {
"url": "bolt://localhost:7687",
"username": "memgraph",
"password": "xxx"
}
}
}
m = Memory.from_config(config_dict=config)
```
</CodeGroup>
## Graph Operations
The Mem0's graph supports the following operations:
+2
View File
@@ -4,6 +4,8 @@ icon: "image"
iconType: "solid"
---
<Snippet file="paper-release.mdx" />
Mem0 extends its capabilities beyond text by supporting multimodal data, including images. Users can seamlessly integrate images into their interactions, allowing Mem0 to extract pertinent information from visual content and enrich the memory system.
## How It Works
+2
View File
@@ -5,6 +5,8 @@ icon: "node"
iconType: "solid"
---
<Snippet file="paper-release.mdx" />
> Welcome to the Mem0 quickstart guide. This guide will help you get up and running with Mem0 in no time.
## Installation

Some files were not shown because too many files have changed in this diff Show More