diff --git a/cookbooks/add_memory_using_qdrant_cloud.py b/cookbooks/add_memory_using_qdrant_cloud.py
deleted file mode 100644
index 0ca02e52..00000000
--- a/cookbooks/add_memory_using_qdrant_cloud.py
+++ /dev/null
@@ -1,36 +0,0 @@
-# This example shows how to use vector config to use QDRANT CLOUD
-import os
-
-from dotenv import load_dotenv
-
-from mem0 import Memory
-
-# Loading OpenAI API Key
-load_dotenv()
-OPENAI_API_KEY = os.environ.get("OPENAI_API_KEY")
-USER_ID = "test"
-quadrant_host = "xx.gcp.cloud.qdrant.io"
-
-# creating the config attributes
-collection_name = "memory" # this is the collection I created in QDRANT cloud
-api_key = os.environ.get("QDRANT_API_KEY") # Getting the QDRANT api KEY
-host = quadrant_host
-port = 6333 # Default port for QDRANT cloud
-
-# Creating the config dict
-config = {
- "vector_store": {
- "provider": "qdrant",
- "config": {"collection_name": collection_name, "host": host, "port": port, "path": None, "api_key": api_key},
- }
-}
-
-# this is the change, create the memory class using from config
-memory = Memory().from_config(config)
-
-USER_DATA = """
-I am a strong believer in memory architecture.
-"""
-
-response = memory.add(USER_DATA, user_id=USER_ID)
-print(response)
diff --git a/cookbooks/mem0-multion.ipynb b/cookbooks/mem0-multion.ipynb
deleted file mode 100644
index 98e30456..00000000
--- a/cookbooks/mem0-multion.ipynb
+++ /dev/null
@@ -1,189 +0,0 @@
-{
- "cells": [
- {
- "cell_type": "code",
- "execution_count": null,
- "metadata": {
- "id": "y4bKPPa7DXNs"
- },
- "outputs": [],
- "source": [
- "%pip install mem0ai multion"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {
- "id": "pe4htqUmDdmS"
- },
- "source": [
- "## Setup and Configuration\n",
- "\n",
- "First, we'll import the necessary libraries and set up our configurations.\n",
- "\n"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 2,
- "metadata": {
- "id": "fsZwK7eLDh3I"
- },
- "outputs": [],
- "source": [
- "import os\n",
- "from mem0 import Memory\n",
- "from multion.client import MultiOn\n",
- "\n",
- "# Configuration\n",
- "OPENAI_API_KEY = \"sk-xxx\" # Replace with your actual OpenAI API key\n",
- "MULTION_API_KEY = \"your-multion-key\" # Replace with your actual MultiOn API key\n",
- "USER_ID = \"deshraj\"\n",
- "\n",
- "# Set up OpenAI API key\n",
- "os.environ[\"OPENAI_API_KEY\"] = OPENAI_API_KEY\n",
- "\n",
- "# Initialize Mem0 and MultiOn\n",
- "memory = Memory()\n",
- "multion = MultiOn(api_key=MULTION_API_KEY)"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {
- "id": "HTGVhGwaDl-1"
- },
- "source": [
- "## Add memories to Mem0\n",
- "\n",
- "Next, we'll define our user data and add it to Mem0."
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 3,
- "metadata": {
- "colab": {
- "base_uri": "https://localhost:8080/"
- },
- "id": "xB3tm0_pDm6e",
- "outputId": "aeab370c-8679-4d39-faaa-f702146d2fc4"
- },
- "outputs": [
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "User data added to memory.\n"
- ]
- }
- ],
- "source": [
- "# Define user data\n",
- "USER_DATA = \"\"\"\n",
- "About me\n",
- "- I'm Deshraj Yadav, Co-founder and CTO at Mem0 (f.k.a Embedchain). I am broadly interested in the field of Artificial Intelligence and Machine Learning Infrastructure.\n",
- "- Previously, I was Senior Autopilot Engineer at Tesla Autopilot where I led the Autopilot's AI Platform which helped the Tesla Autopilot team to track large scale training and model evaluation experiments, provide monitoring and observability into jobs and training cluster issues.\n",
- "- I had built EvalAI as my masters thesis at Georgia Tech, which is an open-source platform for evaluating and comparing machine learning and artificial intelligence algorithms at scale.\n",
- "- Outside of work, I am very much into cricket and play in two leagues (Cricbay and NACL) in San Francisco Bay Area.\n",
- "\"\"\"\n",
- "\n",
- "# Add user data to memory\n",
- "memory.add(USER_DATA, user_id=USER_ID)\n",
- "print(\"User data added to memory.\")"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {
- "id": "ZCPUJf0TDqUK"
- },
- "source": [
- "## Retrieving Relevant Memories\n",
- "\n",
- "Now, we'll define our search command and retrieve relevant memories from Mem0."
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 10,
- "metadata": {
- "colab": {
- "base_uri": "https://localhost:8080/"
- },
- "id": "s0PwAhNVDrIv",
- "outputId": "59cbb767-b468-4139-8d0c-fa763918dbb0"
- },
- "outputs": [
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Relevant memories:\n",
- "Name: Deshraj Yadav - Co-founder and CTO at Mem0 (formerly known as Embedchain) - Interested in Artificial Intelligence and Machine Learning Infrastructure - Previous role: Senior Autopilot Engineer at Tesla Autopilot - Led the Autopilot's AI Platform at Tesla, focusing on large scale training, model evaluation, monitoring, and observability - Built EvalAI as a master's thesis at Georgia Tech, an open-source platform for evaluating and comparing machine learning algorithms - Enjoys cricket - Plays in two cricket leagues: Cricbay and NACL in the San Francisco Bay Area\n"
- ]
- }
- ],
- "source": [
- "# Define search command and retrieve relevant memories\n",
- "command = \"Find papers on arxiv that I should read based on my interests.\"\n",
- "\n",
- "relevant_memories = memory.search(command, 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)"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {
- "id": "jdge78_VDtgv"
- },
- "source": [
- "## Browsing arXiv\n",
- "\n",
- "Finally, we'll use MultiOn to browse arXiv based on our command and relevant memories."
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 11,
- "metadata": {
- "colab": {
- "base_uri": "https://localhost:8080/"
- },
- "id": "4T_tLURTDvS-",
- "outputId": "259ff32f-5d42-44e6-f2ef-c3557a8e9da6"
- },
- "outputs": [
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "message=\"Summarizing the relevant papers found so far that align with Deshraj Yadav's interests in Artificial Intelligence and Machine Learning Infrastructure.\\n\\n1. **Urban Waterlogging Detection: A Challenging Benchmark and Large-Small Model Co-Adapter**\\n - Authors: Suqi Song, Chenxu Zhang, Peng Zhang, Pengkun Li, Fenglong Song, Lei Zhang\\n - Abstract: Urban waterlogging poses a major risk to public safety. Conventional methods using water-level sensors need high-maintenance to hardly achieve full coverage. Recent advances employ surveillance camera imagery and deep learning for detection, yet these struggle amidst scarce data and adverse environments.\\n - Date: 10 July, 2024\\n\\n2. **Intercepting Unauthorized Aerial Robots in Controlled Airspace Using Reinforcement Learning**\\n - Authors: Francisco Giral, Ignacio Gómez, Soledad Le Clainche\\n - Abstract: Ensuring the safe and efficient operation of airspace, particularly in urban environments and near critical infrastructure, necessitates effective methods to intercept unauthorized or non-cooperative UAVs. This work addresses the critical need for robust, adaptive systems capable of managing such scenarios.\\n - Date: 9 July, 2024\\n\\n3. **Efficient Materials Informatics between Rockets and Electrons**\\n - Authors: Adam M. Krajewski\\n - Abstract: This paper discusses the distinct efforts existing at three general scales of abstractions of what a material is - atomistic, physical, and design. At each, an efficient materials informatics is being built from the ground up based on the fundamental understanding of the underlying prior knowledge, including the data.\\n - Date: 5 July, 2024\\n\\n4. **ObfuscaTune: Obfuscated Offsite Fine-tuning and Inference of Proprietary LLMs on Private Datasets**\\n - Authors: Ahmed Frikha, Nassim Walha, Ricardo Mendes, Krishna Kanth Nakka, Xue Jiang, Xuebing Zhou\\n - Abstract: This paper proposes ObfuscaTune, a novel, efficient, and fully utility-preserving approach that combines a simple yet effective method to ensure the confidentiality of both the model and the data during offsite fine-tuning on a third-party cloud provider.\\n - Date: 3 July, 2024\\n\\n5. **MG-Verilog: Multi-grained Dataset Towards Enhanced LLM-assisted Verilog Generation**\\n - Authors: Yongan Zhang, Zhongzhi Yu, Yonggan Fu, Cheng Wan, Yingyan Celine Lin\\n - Abstract: This paper discusses the necessity of providing domain-specific data during inference, fine-tuning, or pre-training to effectively leverage LLMs in hardware design. Existing publicly available hardware datasets are often limited in size, complexity, or detail, which hinders the effectiveness of LLMs in this domain.\\n - Date: 1 July, 2024\\n\\n6. **The Future of Aerial Communications: A Survey of IRS-Enhanced UAV Communication Technologies**\\n - Authors: Zina Chkirbene, Ala Gouissem, Ridha Hamila, Devrim Unal\\n - Abstract: The advent of Reflecting Surfaces (IRS) and Unmanned Aerial Vehicles (UAVs) is setting a new benchmark in the field of wireless communications. IRS, with their groundbreaking ability to manipulate electromagnetic waves, have opened avenues for substantial enhancements in signal quality, network efficiency, and spectral usage.\\n - Date: 2 June, 2024\\n\\n7. **Scalable and RISC-V Programmable Near-Memory Computing Architectures for Edge Nodes**\\n - Authors: Michele Caon, Clément Choné, Pasquale Davide Schiavone, Alexandre Levisse, Guido Masera, Maurizio Martina, David Atienza\\n - Abstract: The widespread adoption of data-centric algorithms, particularly AI and ML, has exposed the limitations of centralized processing, driving the need for scalable and programmable near-memory computing architectures for edge nodes.\\n - Date: 20 June, 2024\\n\\n8. **Enhancing robustness of data-driven SHM models: adversarial training with circle loss**\\n - Authors: Xiangli Yang, Xijie Deng, Hanwei Zhang, Yang Zou, Jianxi Yang\\n - Abstract: Structural health monitoring (SHM) is critical to safeguarding the safety and reliability of aerospace, civil, and mechanical infrastructures. This paper discusses the use of adversarial training with circle loss to enhance the robustness of data-driven SHM models.\\n - Date: 20 June, 2024\\n\\n9. **Understanding Pedestrian Movement Using Urban Sensing Technologies: The Promise of Audio-based Sensors**\\n - Authors: Chaeyeon Han, Pavan Seshadri, Yiwei Ding, Noah Posner, Bon Woo Koo, Animesh Agrawal, Alexander Lerch, Subhrajit Guhathakurta\\n - Abstract: Understanding pedestrian volumes and flows is essential for designing safer and more attractive pedestrian infrastructures. This study discusses a new approach to scale up urban sensing of people with the help of novel audio-based technology.\\n - Date: 14 June, 2024\\n\\nASK_USER_HELP: Deshraj, I have found several papers that might be of interest to you. Would you like to proceed with any specific papers from the list above, or should I refine the search further?\\n\" status='NOT_SURE' url='https://arxiv.org/search/?query=Artificial+Intelligence+Machine+Learning+Infrastructure&searchtype=all&source=header' screenshot='' session_id='ff2ee9ef-60d4-4436-bc36-a81d94e0f410' metadata=Metadata(step_count=9, processing_time=66, temperature=0.2)\n"
- ]
- }
- ],
- "source": [
- "# Create prompt and browse arXiv\n",
- "prompt = f\"{command}\\n My past memories: {relevant_memories_text}\"\n",
- "browse_result = multion.browse(cmd=prompt, url=\"https://arxiv.org/\")\n",
- "print(browse_result)"
- ]
- }
- ],
- "metadata": {
- "colab": {
- "provenance": []
- },
- "kernelspec": {
- "display_name": "Python 3",
- "name": "python3"
- },
- "language_info": {
- "name": "python"
- }
- },
- "nbformat": 4,
- "nbformat_minor": 0
-}
diff --git a/cookbooks/multion_travel_agent.ipynb b/cookbooks/multion_travel_agent.ipynb
deleted file mode 100644
index f9211da1..00000000
--- a/cookbooks/multion_travel_agent.ipynb
+++ /dev/null
@@ -1,296 +0,0 @@
-{
- "cells": [
- {
- "cell_type": "code",
- "execution_count": null,
- "metadata": {
- "id": "fu3euPKZsbaC"
- },
- "outputs": [],
- "source": [
- "!pip install mem0ai"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "metadata": {
- "id": "U2VC_0FElQid"
- },
- "outputs": [],
- "source": [
- "import os\n",
- "from openai import OpenAI\n",
- "from mem0 import MemoryClient\n",
- "from multion.client import MultiOn\n",
- "\n",
- "# Configuration\n",
- "OPENAI_API_KEY = \"sk-xxx\" # Replace with your actual OpenAI API key\n",
- "MULTION_API_KEY = \"xx\" # Replace with your actual MultiOn API key\n",
- "MEM0_API_KEY = \"xx\" # Replace with your actual Mem0 API key\n",
- "USER_ID = \"test_travel_agent\"\n",
- "\n",
- "# Set up OpenAI API key\n",
- "os.environ[\"OPENAI_API_KEY\"] = OPENAI_API_KEY\n",
- "\n",
- "# Initialize Mem0 and MultiOn\n",
- "memory = MemoryClient(api_key=MEM0_API_KEY)\n",
- "multion = MultiOn(api_key=MULTION_API_KEY)"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "metadata": {
- "id": "sq-OdPHKlQie",
- "outputId": "1d605222-0bf5-4ac9-99b9-6059b502c20b"
- },
- "outputs": [
- {
- "data": {
- "text/plain": [
- "{'message': 'Memory added successfully!'}"
- ]
- },
- "execution_count": 2,
- "metadata": {},
- "output_type": "execute_result"
- }
- ],
- "source": [
- "# Add conversation to Mem0\n",
- "conversation = [\n",
- " {\"role\": \"user\", \"content\": \"What are the best travel destinations in the world?\"},\n",
- " {\n",
- " \"role\": \"assistant\",\n",
- " \"content\": \"Could you please specify your interests or the type of travel information you are looking for? This will help me find the most relevant information for you.\",\n",
- " },\n",
- " {\"role\": \"user\", \"content\": \"Sure, I want to travel to San Francisco.\"},\n",
- " {\n",
- " \"role\": \"assistant\",\n",
- " \"content\": \"\"\"\n",
- " Based on the information gathered from TripAdvisor, here are some popular attractions, activities, and travel tips for San Francisco:\n",
- "\n",
- " 1. **Golden Gate Bridge**: A must-see iconic landmark.\n",
- " 2. **Alcatraz Island**: Famous former prison offering tours.\n",
- " 3. **Fisherman's Wharf**: Popular tourist area with shops, restaurants, and sea lions.\n",
- " 4. **Chinatown**: The largest Chinatown outside of Asia.\n",
- " 5. **Golden Gate Park**: Large urban park with gardens, museums, and recreational activities.\n",
- " 6. **Cable Cars**: Historic streetcars offering a unique way to see the city.\n",
- " 7. **Exploratorium**: Interactive science museum.\n",
- " 8. **San Francisco Museum of Modern Art (SFMOMA)**: Modern and contemporary art museum.\n",
- " 9. **Lombard Street**: Known for its steep, one-block section with eight hairpin turns.\n",
- " 10. **Union Square**: Major shopping and cultural hub.\n",
- "\n",
- " Travel Tips:\n",
- " - **Weather**: San Francisco has a mild climate, but it can be foggy and windy. Dress in layers.\n",
- " - **Transportation**: Use public transportation like BART, Muni, and cable cars to get around.\n",
- " - **Safety**: Be aware of your surroundings, especially in crowded tourist areas.\n",
- " - **Dining**: Try local specialties like sourdough bread, seafood, and Mission-style burritos.\n",
- " \"\"\",\n",
- " },\n",
- " {\"role\": \"user\", \"content\": \"Show me hotels around Golden Gate Bridge.\"},\n",
- " {\n",
- " \"role\": \"assistant\",\n",
- " \"content\": \"\"\"\n",
- " The search results for hotels around Golden Gate Bridge in San Francisco include:\n",
- "\n",
- " 1. Hilton Hotels In San Francisco - Hotel Near Fishermans Wharf (hilton.com)\n",
- " 2. The 10 Closest Hotels to Golden Gate Bridge (tripadvisor.com)\n",
- " 3. Hotels near Golden Gate Bridge (expedia.com)\n",
- " 4. Hotels near Golden Gate Bridge (hotels.com)\n",
- " 5. Holiday Inn Express & Suites San Francisco Fishermans Wharf, an IHG Hotel $146 (1.8K) 3-star hotel Golden Gate Bridge • 3.5 mi DEAL 19% less than usual\n",
- " 6. Holiday Inn San Francisco-Golden Gateway, an IHG Hotel $151 (3.5K) 3-star hotel Golden Gate Bridge • 3.7 mi Casual hotel with dining, a bar & a pool\n",
- " 7. Hotel Zephyr San Francisco $159 (3.8K) 4-star hotel Golden Gate Bridge • 3.7 mi Nautical-themed lodging with bay views\n",
- " 8. Lodge at the Presidio\n",
- " 9. The Inn Above Tide\n",
- " 10. Cavallo Point\n",
- " 11. Casa Madrona Hotel and Spa\n",
- " 12. Cow Hollow Inn and Suites\n",
- " 13. Samesun San Francisco\n",
- " 14. Inn on Broadway\n",
- " 15. Coventry Motor Inn\n",
- " 16. HI San Francisco Fisherman's Wharf Hostel\n",
- " 17. Loews Regency San Francisco Hotel\n",
- " 18. Fairmont Heritage Place Ghirardelli Square\n",
- " 19. Hotel Drisco Pacific Heights\n",
- " 20. Travelodge by Wyndham Presidio San Francisco\n",
- " \"\"\",\n",
- " },\n",
- "]\n",
- "\n",
- "memory.add(conversation, user_id=USER_ID)"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "metadata": {
- "id": "hO8z9aNTlQif"
- },
- "outputs": [],
- "source": [
- "def get_travel_info(question, use_memory=True):\n",
- " \"\"\"\n",
- " Get travel information based on user's question and optionally their preferences from memory.\n",
- "\n",
- " \"\"\"\n",
- " if use_memory:\n",
- " previous_memories = memory.search(question, user_id=USER_ID)\n",
- " relevant_memories_text = \"\"\n",
- " if previous_memories:\n",
- " print(\"Using previous memories to enhance the search...\")\n",
- " relevant_memories_text = \"\\n\".join(mem[\"memory\"] for mem in previous_memories)\n",
- "\n",
- " command = \"Find travel information based on my interests:\"\n",
- " prompt = f\"{command}\\n Question: {question} \\n My preferences: {relevant_memories_text}\"\n",
- " else:\n",
- " command = \"Find travel information based on my interests:\"\n",
- " prompt = f\"{command}\\n Question: {question}\"\n",
- "\n",
- " print(\"Searching for travel information...\")\n",
- " browse_result = multion.browse(cmd=prompt)\n",
- " return browse_result.message"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {
- "id": "Wp2xpzMrlQig"
- },
- "source": [
- "## Example 1"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "metadata": {
- "id": "bPRPwqsplQig"
- },
- "outputs": [],
- "source": [
- "question = \"Show me flight details for it.\"\n",
- "answer_without_memory = get_travel_info(question, use_memory=False)\n",
- "answer_with_memory = get_travel_info(question, use_memory=True)"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {
- "id": "a76ifa2HlQig"
- },
- "source": [
- "| Without Memory | With Memory |\n",
- "|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n",
- "| I have performed a Google search for \"flight details\" and reviewed the search results. Here are some relevant links and information: | Memorizing the following information: Flight details for San Francisco: |\n",
- "| 1. **FlightStats Global Flight Tracker** - Track the real-time flight status of your flight. See if your flight has been delayed or cancelled and track the live status.
[Flight Tracker - FlightStats](https://www.flightstats.com/flight-tracker/search) | 1. Prices from $232. Depart Thursday, August 22. Return Thursday, August 29.
2. Prices from $216. Depart Friday, August 23. Return Friday, August 30.
3. Prices from $236. Depart Saturday, August 24. Return Saturday, August 31.
4. Prices from $215. Depart Sunday, August 25. Return Sunday, September 1. |\n",
- "| 2. **FlightAware - Flight Tracker** - Track live flights worldwide, see flight cancellations, and browse by airport.
[FlightAware - Flight Tracker](https://www.flightaware.com) | 5. Prices from $218. Depart Monday, August 26. Return Monday, September 2.
6. Prices from $211. Depart Tuesday, August 27. Return Tuesday, September 3.
7. Prices from $198. Depart Wednesday, August 28. Return Wednesday, September 4.
8. Prices from $218. Depart Thursday, August 29. Return Thursday, September 5. |\n",
- "| 3. **Google Flights** - Show flights based on your search.
[Google Flights](https://www.google.com/flights) | 9. Prices from $194. Depart Friday, August 30. Return Friday, September 6.
10. Prices from $218. Depart Saturday, August 31. Return Saturday, September 7.
11. Prices from $212. Depart Sunday, September 1. Return Sunday, September 8.
12. Prices from $247. Depart Monday, September 2. Return Monday, September 9. |\n",
- "| | 13. Prices from $212. Depart Tuesday, September 3. Return Tuesday, September 10.
14. Prices from $203. Depart Wednesday, September 4. Return Wednesday, September 11.
15. Prices from $242. Depart Thursday, September 5. Return Thursday, September 12.
16. Prices from $191. Depart Friday, September 6. Return Friday, September 13. |\n",
- "| | 17. Prices from $215. Depart Saturday, September 7. Return Saturday, September 14.
18. Prices from $229. Depart Sunday, September 8. Return Sunday, September 15.
19. Prices from $183. Depart Monday, September 9. Return Monday, September 16.
65. Prices from $194. Depart Friday, October 25. Return Friday, November 1. |\n",
- "| | 66. Prices from $205. Depart Saturday, October 26. Return Saturday, November 2.
67. Prices from $241. Depart Sunday, October 27. Return Sunday, November 3. |\n"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {
- "id": "0cXpiAwMlQig"
- },
- "source": [
- "## Example 2"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "metadata": {
- "id": "LpprKfpslQih"
- },
- "outputs": [],
- "source": [
- "question = \"What places to visit there?\"\n",
- "answer_without_memory = get_travel_info(question, use_memory=False)\n",
- "answer_with_memory = get_travel_info(question, use_memory=True)"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {
- "id": "kpfjeY1_lQih"
- },
- "source": [
- "| Without Memory | With Memory |\n",
- "|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n",
- "| Based on the information gathered, here are some top travel destinations to consider visiting: | Based on the information gathered, here are some top places to visit in San Francisco: |\n",
- "| 1. **Paris**: Known for its iconic attractions like the Eiffel Tower and the Louvre, Paris offers quaint cafes, trendy shopping districts, and beautiful Haussmann architecture. It's a city where you can always discover something new with each visit. | 1. **Golden Gate Bridge** - An iconic symbol of San Francisco, perfect for walking, biking, or simply enjoying the view.
2. **Alcatraz Island** - The historic former prison offers tours and insights into its storied past.
3. **Fisherman's Wharf** - A bustling waterfront area known for its seafood, shopping, and attractions like Pier 39.
4. **Golden Gate Park** - A large urban park with gardens, museums, and recreational activities.
5. **Chinatown San Francisco** - One of the oldest and most famous Chinatowns in North America, offering unique shops and delicious food.
6. **Coit Tower** - Offers panoramic views of the city and murals depicting San Francisco's history.
7. **Lands End** - A beautiful coastal trail with stunning views of the Pacific Ocean and the Golden Gate Bridge.
8. **Palace of Fine Arts** - A picturesque structure and park, perfect for a leisurely stroll or photo opportunities.
9. **Crissy Field & The Presidio Tunnel Tops** - Great for outdoor activities and scenic views of the bay. |\n",
- "| 2. **Bora Bora**: This small island in French Polynesia is famous for its stunning turquoise waters, luxurious overwater bungalows, and vibrant coral reefs. It's a popular destination for honeymooners and those seeking a tropical paradise. | |\n",
- "| 3. **Glacier National Park**: Located in Montana, USA, this park is known for its breathtaking landscapes, including rugged mountains, pristine lakes, and diverse wildlife. It's a haven for outdoor enthusiasts and hikers. | |\n",
- "| 4. **Rome**: The capital of Italy, Rome is rich in history and culture, featuring landmarks such as the Colosseum, the Vatican, and the Pantheon. It's a city where ancient history meets modern life. | |\n",
- "| 5. **Swiss Alps**: Renowned for their stunning natural beauty, the Swiss Alps offer opportunities for skiing, hiking, and enjoying picturesque mountain villages. | |\n",
- "| 6. **Maui**: One of Hawaii's most popular islands, Maui is known for its beautiful beaches, lush rainforests, and the scenic Hana Highway. It's a great destination for both relaxation and adventure. | |\n",
- "| 7. **London, England**: A vibrant city with a mix of historical landmarks like the Tower of London and modern attractions such as the London Eye. London offers diverse cultural experiences, world-class museums, and a bustling nightlife. | |\n",
- "| 8. **Maldives**: This tropical paradise in the Indian Ocean is famous for its crystal-clear waters, luxurious resorts, and abundant marine life. It's an ideal destination for snorkeling, diving, and relaxation. | |\n",
- "| 9. **Turks & Caicos**: Known for its pristine beaches and turquoise waters, this Caribbean destination is perfect for water sports, beach lounging, and exploring coral reefs. | |\n",
- "| 10. **Tokyo**: Japan's bustling capital offers a unique blend of traditional and modern attractions, from ancient temples to futuristic skyscrapers. Tokyo is also known for its vibrant food scene and shopping districts. | |\n"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {
- "id": "XdpkcMrclQih"
- },
- "source": [
- "## Example 3"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "metadata": {
- "id": "Nntl2FxulQih"
- },
- "outputs": [],
- "source": [
- "question = \"What the weather there?\"\n",
- "answer_without_memory = get_travel_info(question, use_memory=False)\n",
- "answer_with_memory = get_travel_info(question, use_memory=True)"
- ]
- },
- {
- "cell_type": "markdown",
- "metadata": {
- "id": "yt2pj1irlQih"
- },
- "source": [
- "| Without Memory | With Memory |\n",
- "|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n",
- "| The current weather in Paris is light rain with a temperature of 67°F. The precipitation is at 50%, humidity is 95%, and the wind speed is 5 mph. | The current weather in San Francisco is as follows:
- **Temperature**: 59°F
- **Condition**: Clear with periodic clouds
- **Precipitation**: 3%
- **Humidity**: 87%
- **Wind**: 12 mph |\n"
- ]
- }
- ],
- "metadata": {
- "colab": {
- "provenance": []
- },
- "kernelspec": {
- "display_name": ".venv",
- "language": "python",
- "name": "python3"
- },
- "language_info": {
- "codemirror_mode": {
- "name": "ipython",
- "version": 3
- },
- "file_extension": ".py",
- "mimetype": "text/x-python",
- "name": "python",
- "nbconvert_exporter": "python",
- "pygments_lexer": "ipython3",
- "version": "3.12.3"
- }
- },
- "nbformat": 4,
- "nbformat_minor": 0
-}
\ No newline at end of file
diff --git a/docs/integrations/langchain.mdx b/docs/integrations/langchain.mdx
new file mode 100644
index 00000000..6d6fdb39
--- /dev/null
+++ b/docs/integrations/langchain.mdx
@@ -0,0 +1,157 @@
+---
+title: Langchain
+---
+
+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
+
+In this guide, we'll create a Travel Agent AI that:
+1. Uses LangChain to manage conversation flow
+2. Leverages Mem0 to store and retrieve relevant information from past interactions
+3. Provides personalized travel recommendations based on user history
+
+## Setup and Configuration
+
+Install necessary libraries:
+
+```bash
+pip install langchain langchain_openai mem0ai
+```
+
+Import required modules and set up configurations:
+
+Remember to get the Mem0 API key from [Mem0 Platform](https://app.mem0.ai).
+
+```python
+import os
+from typing import List, Dict
+from langchain_openai import ChatOpenAI
+from langchain_core.messages import SystemMessage, HumanMessage, AIMessage
+from langchain_core.prompts import ChatPromptTemplate, MessagesPlaceholder
+from mem0 import MemoryClient
+
+# Configuration
+os.environ["OPENAI_API_KEY"] = "your-openai-api-key"
+os.environ["MEM0_API_KEY"] = "your-mem0-api-key"
+
+# Initialize LangChain and Mem0
+llm = ChatOpenAI(model="gpt-4o-mini")
+mem0 = MemoryClient(api_key=os.environ["MEM0_API_KEY"])
+```
+
+## Create Prompt Template
+
+Set up the conversation prompt template:
+
+```python
+prompt = ChatPromptTemplate.from_messages([
+ SystemMessage(content="""You are a helpful travel agent AI. Use the provided context to personalize your responses and remember user preferences and past interactions.
+ Provide travel recommendations, itinerary suggestions, and answer questions about destinations.
+ If you don't have specific information, you can make general suggestions based on common travel knowledge."""),
+ MessagesPlaceholder(variable_name="context"),
+ HumanMessage(content="{input}")
+])
+```
+
+## Define Helper Functions
+
+Create functions to handle context retrieval, response generation, and addition to Mem0:
+
+```python
+def retrieve_context(query: str, user_id: str) -> List[Dict]:
+ """Retrieve relevant context from Mem0"""
+ memories = mem0.search(query, user_id=user_id)
+ seralized_memories = ' '.join([mem["memory"] for mem in memories])
+ context = [
+ {
+ "role": "system",
+ "content": f"Relevant information: {seralized_memories}"
+ },
+ {
+ "role": "user",
+ "content": query
+ }
+ ]
+ return context
+
+def generate_response(input: str, context: List[Dict]) -> str:
+ """Generate a response using the language model"""
+ chain = prompt | llm
+ response = chain.invoke({
+ "context": context,
+ "input": input
+ })
+ return response.content
+
+def save_interaction(user_id: str, user_input: str, assistant_response: str):
+ """Save the interaction to Mem0"""
+ interaction = [
+ {
+ "role": "user",
+ "content": user_input
+ },
+ {
+ "role": "assistant",
+ "content": assistant_response
+ }
+ ]
+ mem0.add(interaction, user_id=user_id)
+```
+
+## Create Chat Turn Function
+
+Implement the main function to manage a single turn of conversation:
+
+```python
+def chat_turn(user_input: str, user_id: str) -> str:
+ # Retrieve context
+ context = retrieve_context(user_input, user_id)
+
+ # Generate response
+ response = generate_response(user_input, context)
+
+ # Save interaction
+ save_interaction(user_id, user_input, response)
+
+ return response
+```
+
+## Main Interaction Loop
+
+Set up the main program loop for user interaction:
+
+```python
+if __name__ == "__main__":
+ print("Welcome to your personal Travel Agent Planner! How can I assist you with your travel plans today?")
+ user_id = "john"
+
+ while True:
+ user_input = input("You: ")
+ if user_input.lower() in ['quit', 'exit', 'bye']:
+ print("Travel Agent: Thank you for using our travel planning service. Have a great trip!")
+ break
+
+ response = chat_turn(user_input, user_id)
+ print(f"Travel Agent: {response}")
+```
+
+## Key Features
+
+1. **Memory Integration**: Uses Mem0 to store and retrieve relevant information from past interactions.
+2. **Personalization**: Provides context-aware responses based on user history and preferences.
+3. **Flexible Architecture**: LangChain structure allows for easy expansion of the conversation flow.
+4. **Continuous Learning**: Each interaction is stored, improving future responses.
+
+## Conclusion
+
+By integrating LangChain with Mem0, you can build a personalized Travel Agent AI that can maintain context across interactions and provide tailored travel recommendations and assistance.
+
+## Help
+
+- For more details on LangChain, visit the [LangChain documentation](https://python.langchain.com/).
+- For Mem0 documentation, refer to the [Mem0 Platform](https://app.mem0.ai/).
+- If you need further assistance, please feel free to reach out to us through the following methods:
+
+
+
diff --git a/docs/mint.json b/docs/mint.json
index f46d24ec..2e54ba3c 100644
--- a/docs/mint.json
+++ b/docs/mint.json
@@ -206,6 +206,7 @@
"pages": [
"integrations/multion",
"integrations/autogen",
+ "integrations/langchain",
"integrations/langgraph"
]
},