### Fresh Install: Setup and Start Server Source: https://github.com/mem0ai/mem0/blob/main/docs/migration/server-pgvector-upgrade.mdx Navigate to the server directory, copy the example environment file, edit it with necessary credentials, and start the Docker stack for a new installation. ```bash cd server cp .env.example .env # Edit .env — set POSTGRES_PASSWORD (required) and OPENAI_API_KEY at minimum make up ``` -------------------------------- ### Manual UI Setup Source: https://github.com/mem0ai/mem0/blob/main/openmemory/README.md Install dependencies and run the frontend development server if the UI does not start properly on localhost:3000. ```bash cd ui pnpm install pnpm dev ``` -------------------------------- ### Setup Mem0 OSS (Docker) Source: https://github.com/mem0ai/mem0/blob/main/docs/core-concepts/memory-evaluation.mdx Clone the repository, install dependencies, configure environment variables, and start the local Mem0 server and Qdrant using Docker Compose. ```bash git clone https://github.com/mem0ai/memory-benchmarks.git cd memory-benchmarks pip install -r requirements.txt # Copy and configure environment cp .env.example .env # Edit .env to add OPENAI_API_KEY # Start local Mem0 server + Qdrant docker compose up -d # Mem0 server: http://localhost:8888 # Qdrant: http://localhost:6333 ``` -------------------------------- ### Start containers with browser setup wizard Source: https://github.com/mem0ai/mem0/blob/main/docs/open-source/setup.mdx Starts the REST API and dashboard containers, then redirects to the setup wizard at http://localhost:3000/setup to create the admin account through the browser. ```bash cd server make up ``` -------------------------------- ### mem0 init Command Examples Source: https://github.com/mem0ai/mem0/blob/main/skills/mem0-cli/references/command-reference.md These examples demonstrate various ways to initialize the mem0 CLI, including interactive setup, non-interactive setup with API keys or email, and configuring agent mode. ```bash mem0 init ``` ```bash mem0 init --api-key m0-xxx --user-id alice ``` ```bash mem0 init --api-key m0-xxx --user-id alice --force ``` ```bash mem0 init --email alice@company.com ``` ```bash mem0 init --email alice@company.com --code 482901 ``` ```bash mem0 init --agent --agent-caller claude-code # AI agent self-identifies during bootstrap ``` -------------------------------- ### Quick start examples for mem0 CLI Source: https://github.com/mem0ai/mem0/blob/main/cli/node/README.md Common workflows including adding a memory, searching, listing, getting, updating, and deleting memories for a user. ```bash # Interactive setup wizard mem0 init ``` ```bash # Or login via email mem0 init --email alice@company.com ``` ```bash # Or authenticate with an existing API key mem0 init --api-key m0-xxx ``` ```bash # Add a memory mem0 add "I prefer dark mode and use vim keybindings" --user-id alice ``` ```bash # Search memories mem0 search "What are Alice's preferences?" --user-id alice ``` ```bash # List all memories for a user mem0 list --user-id alice ``` ```bash # Get a specific memory mem0 get ``` ```bash # Update a memory mem0 update "I switched to light mode" ``` ```bash # Delete a memory mem0 delete ``` -------------------------------- ### Full Setup Script Download and Run Source: https://github.com/mem0ai/mem0/blob/main/examples/nemoclaw/quickstart.md Download and execute the complete setup script for NemoClaw and Mem0 plugin installation. Use this if NemoClaw is not yet installed. ```bash # Download curl -fsSL https://raw.githubusercontent.com/mem0ai/mem0/main/examples/nemoclaw/setup-mem0-nemoclaw.sh -o setup-mem0-nemoclaw.sh # Run chmod +x setup-mem0-nemoclaw.sh ./setup-mem0-nemoclaw.sh ``` -------------------------------- ### Install Dependencies and Start Services for Mem0 Open Source Source: https://github.com/mem0ai/mem0/blob/main/docs/cookbooks/essentials/building-ai-companion.mdx These commands install necessary Python packages and start Qdrant and Ollama services required for the Mem0 open-source setup. ```bash pip install mem0ai qdrant-client openai ollama ``` ```bash docker run -d -p 6333:6333 qdrant/qdrant ``` ```bash ollama pull llama3.1:latest ``` ```bash ollama pull nomic-embed-text:latest ``` -------------------------------- ### Setup with Make Source: https://github.com/mem0ai/mem0/blob/main/cli/python/development.md Install the CLI in editable mode and with dev tools using Make targets. Make automatically creates a virtual environment and installs dependencies. ```bash # Install the CLI in editable mode make install ``` ```bash # Install with dev tools (tests + linting) make dev ``` -------------------------------- ### Quick Setup with Bash Script Source: https://github.com/mem0ai/mem0/blob/main/openmemory/README.md One-command installation using curl to download and execute the setup script. Requires Docker and OpenAI API key. ```bash curl -sL https://raw.githubusercontent.com/mem0ai/mem0/main/openmemory/run.sh | bash ``` -------------------------------- ### Install and Start Flowise Source: https://github.com/mem0ai/mem0/blob/main/docs/integrations/flowise.mdx Install Flowise globally using npm and then start the application to access its UI. ```bash npm install -g flowise npx flowise start ``` -------------------------------- ### Install and Start vLLM Server Source: https://github.com/mem0ai/mem0/blob/main/docs/components/llms/models/vllm.mdx Commands to install the vLLM package and start the inference server using either a small testing model or a larger production-ready model. ```bash pip install vllm # For testing with a small model vllm serve microsoft/DialoGPT-medium --port 8000 # For production with a larger model (requires GPU) vllm serve Qwen/Qwen2.5-32B-Instruct --port 8000 ``` -------------------------------- ### Setup and Run Benchmarks Source: https://github.com/mem0ai/mem0/blob/main/CLAUDE.md Clone the memory-benchmarks repository, install dependencies, and run specific benchmark scripts. ```bash git clone https://github.com/mem0ai/memory-benchmarks.git cd memory-benchmarks pip install -r requirements.txt ``` ```bash python -m benchmarks.locomo.run --project-name my-test --backend cloud --mem0-api-key $MEM0_API_KEY python -m benchmarks.longmemeval.run --project-name my-test --backend cloud --mem0-api-key $MEM0_API_KEY --all-questions python -m benchmarks.beam.run --project-name my-test --backend cloud --mem0-api-key $MEM0_API_KEY --chat-sizes 100K --conversations 0-9 ``` -------------------------------- ### Initialize open-source Mem0 with interactive wizard Source: https://github.com/mem0ai/mem0/blob/main/docs/integrations/openclaw.mdx Run the guided 4-step setup wizard for self-hosted open-source mode. Prompts for LLM provider, embedding provider, vector store, and user ID configuration. ```bash openclaw mem0 init --mode open-source ``` -------------------------------- ### Start Mem0 Server (Browser-First) Source: https://github.com/mem0ai/mem0/blob/main/server/README.md Start the Docker stack for Mem0. After running, access the dashboard at http://localhost:3000 to complete the setup wizard. ```bash cd server make up ``` -------------------------------- ### Development setup: Install and run mem0 CLI Source: https://github.com/mem0ai/mem0/blob/main/cli/node/README.md Install dependencies and run in development mode with TypeScript, or build and run compiled JavaScript. ```bash cd cli/node pnpm install # Development mode (runs TypeScript directly, no build needed) pnpm dev --help pnpm dev add "test memory" --user-id alice pnpm dev search "test" --user-id alice # Or build first, then run the compiled JS pnpm build node dist/index.js --help ``` -------------------------------- ### Setup with Python Directly Source: https://github.com/mem0ai/mem0/blob/main/cli/python/development.md Create a virtual environment and install the CLI in editable mode with optional dev tools using pip commands. ```bash python3 -m venv .venv source .venv/bin/activate python -m pip install -U pip ``` ```bash # Install in editable mode pip install -e . ``` ```bash # With dev tools pip install -e ".[dev]" ``` -------------------------------- ### Install Mem0 SDK Source: https://github.com/mem0ai/mem0/blob/main/docs/templates/quickstart_template.mdx Install the Mem0 package using package managers for Python and TypeScript environments. This is the first step in setting up the Mem0 memory system. ```bash pip install [package-name] ``` ```bash npm install [package-name] ``` -------------------------------- ### Initialize and Run Learning System Example Source: https://github.com/mem0ai/mem0/blob/main/docs/cookbooks/frameworks/llamaindex-multiagent.mdx Shows the basic usage pattern: create a learning system instance, start sessions with different topics, and retrieve learning history. Memory persists across multiple sessions. ```python # Initialize the learning system learning_system = MultiAgentLearningSystem(student_id="Alexander") # Start a learning session response = await learning_system.start_learning_session( "Vision Language Models", "I'm new to machine learning but I have good hold on Python and have 4 years of work experience." ) # Continue learning in a new session (memory persists) response2 = await learning_system.start_learning_session( "Machine Learning", "what all did I cover so far?" ) # Check learning history history = await learning_system.get_learning_history() ``` -------------------------------- ### Initial Setup for Python SDK Source: https://github.com/mem0ai/mem0/blob/main/AGENTS.md Sets up the Python development environment using Hatch and installs git hooks for pre-commit. ```bash # Python SDK hatch shell dev_py_3_11 # creates environment with all deps pre-commit install # install git hooks ``` -------------------------------- ### Python SDK Initial Setup Source: https://github.com/mem0ai/mem0/blob/main/CLAUDE.md Sets up the Python development environment using Hatch and installs git hooks. ```bash hatch shell dev_py_3_11 pre-commit install ``` -------------------------------- ### Install Mem0 and OpenAI dependencies Source: https://github.com/mem0ai/mem0/blob/main/docs/cookbooks/companions/ai-tutor.mdx Install required packages for the Personalized AI Tutor setup. ```bash pip install openai mem0ai ``` -------------------------------- ### Initialize OpenCLAW (Interactive) Source: https://github.com/mem0ai/mem0/blob/main/integrations/openclaw/README.md Starts the interactive setup process for OpenCLAW. Recommended for initial configuration. ```bash openclaw mem0 init ``` -------------------------------- ### Quick Start Guide Source: https://github.com/mem0ai/mem0/blob/main/cli/python/README.md A sequence of common commands to initialize the CLI and perform basic memory operations. ```bash # Interactive setup wizard mem0 init # Or login via email mem0 init --email alice@company.com # Or authenticate with an existing API key mem0 init --api-key m0-xxx # Add a memory mem0 add "I prefer dark mode and use vim keybindings" --user-id alice # Search memories mem0 search "What are Alice's preferences?" --user-id alice # List all memories for a user mem0 list --user-id alice # Get a specific memory mem0 get # Update a memory mem0 update "I switched to light mode" # Delete a memory mem0 delete ``` -------------------------------- ### Setup Mem0 Cloud Source: https://github.com/mem0ai/mem0/blob/main/docs/core-concepts/memory-evaluation.mdx Clone the repository, install dependencies, and set your API keys for Mem0 Cloud. ```bash git clone https://github.com/mem0ai/memory-benchmarks.git cd memory-benchmarks pip install -r requirements.txt # Set your API keys export MEM0_API_KEY=m0-your-key export OPENAI_API_KEY=sk-your-key ``` -------------------------------- ### Node CLI Initial Setup Source: https://github.com/mem0ai/mem0/blob/main/CLAUDE.md Installs dependencies for the Node CLI using pnpm. ```bash cd cli/node && pnpm install ``` -------------------------------- ### TypeScript SDK Initial Setup Source: https://github.com/mem0ai/mem0/blob/main/CLAUDE.md Installs dependencies for the TypeScript SDK using pnpm. ```bash cd mem0-ts && pnpm install ``` -------------------------------- ### Initial Setup for TypeScript Packages Source: https://github.com/mem0ai/mem0/blob/main/AGENTS.md Installs dependencies for TypeScript SDK, Node CLI, Vercel AI provider, and OpenClaw plugin using pnpm. ```bash # TypeScript packages cd mem0-ts && pnpm install # TS SDK cd cli/node && pnpm install # Node CLI cd integrations/vercel-ai-sdk && pnpm install # Vercel AI provider cd integrations/openclaw && pnpm install # OpenClaw plugin ``` -------------------------------- ### Initialize Mem0 CLI Source: https://github.com/mem0ai/mem0/blob/main/docs/changelog/highlights.mdx Start the interactive setup for the Mem0 CLI, which includes email verification or direct API key entry. ```bash mem0 init ``` -------------------------------- ### Mem0 CLI Quick Start Commands Source: https://github.com/mem0ai/mem0/blob/main/docs/platform/cli.mdx Basic commands for adding, searching, listing, getting, updating, and deleting memories. ```bash # Add a memory mem0 add "I prefer dark mode and use vim keybindings" --user-id alice # Search memories mem0 search "What are Alice's preferences?" --user-id alice # List all memories for a user mem0 list --user-id alice # Get a specific memory mem0 get # Update a memory mem0 update "I prefer light mode now" # Delete a memory mem0 delete ``` -------------------------------- ### Initialize Mem0 CLI with API Key Source: https://github.com/mem0ai/mem0/blob/main/skills/mem0-cli/references/configuration.md Use `mem0 init` to set up the CLI. It supports an interactive flow for guided setup or a non-interactive mode by providing the API key and user ID directly. ```bash # Fully interactive: mem0 init ``` ```bash # Fully non-interactive: mem0 init --api-key m0-xxx --user-id alice ``` -------------------------------- ### mem0 init command examples Source: https://github.com/mem0ai/mem0/blob/main/cli/CLI_SPECIFICATION.md Interactive and non-interactive initialization of mem0 CLI configuration. Use `mem0 init` for interactive setup, `--api-key` and `--user-id` for non-interactive API key flow, `--email` for email verification, and `--force` to skip confirmation prompts. ```bash mem0 init ``` ```bash mem0 init --api-key m0-xxx --user-id alice ``` ```bash mem0 init --api-key m0-xxx --user-id alice --force ``` ```bash mem0 init --email alice@company.com ``` ```bash mem0 init --email alice@company.com --code 482901 ``` -------------------------------- ### Initiate Mem0 Plugin Setup via Chat Source: https://github.com/mem0ai/mem0/blob/main/docs/integrations/openclaw.mdx Paste this command into any OpenClaw chat channel (e.g., Telegram, WhatsApp) to begin the guided setup process for the Mem0 plugin. This is the recommended and fastest way to install. ```plaintext Setup Mem0 from mem0.ai/claw-setup ``` -------------------------------- ### Initialize Mem0 Memory Client Source: https://github.com/mem0ai/mem0/blob/main/docs/templates/quickstart_template.mdx Create a Memory client instance by importing the SDK and providing the API key. This client is used for all subsequent memory operations. ```python from mem0 import Memory memory = Memory(api_key="sk-...") ``` ```typescript import { Memory } from "mem0ai"; const memory = new Memory({ apiKey: process.env.MEM0_API_KEY! }); ``` -------------------------------- ### Connect to Sandbox and Start Gateway Source: https://github.com/mem0ai/mem0/blob/main/examples/nemoclaw/quickstart.md Connect to the NemoClaw sandbox and start the gateway to verify the Mem0 plugin installation. ```bash source ~/.bashrc nemoclaw connect nemoclaw-start ``` -------------------------------- ### Run Mem0 Onboarding Wizard Source: https://github.com/mem0ai/mem0/blob/main/integrations/mem0-plugin/README.md Execute the onboarding command after installation to set up the plugin. This wizard verifies API keys, imports project files, installs memory categories, and displays user identity. It is safe to re-run. ```bash /mem0:onboard ``` -------------------------------- ### Install Cassandra on Ubuntu/Debian Source: https://github.com/mem0ai/mem0/blob/main/docs/components/vectordbs/dbs/cassandra.mdx Install Apache Cassandra from official repository on Ubuntu or Debian systems. Adds Apache Cassandra repository, installs the cassandra package, starts the service, and verifies installation status using nodetool. ```bash # Add Apache Cassandra repository echo "deb https://downloads.apache.org/cassandra/debian 40x main" | sudo tee -a /etc/apt/sources.list.d/cassandra.sources.list curl https://downloads.apache.org/cassandra/KEYS | sudo apt-key add - # Install Cassandra sudo apt-get update sudo apt-get install cassandra # Start Cassandra sudo systemctl start cassandra # Verify installation nodetool status ``` -------------------------------- ### Initialize Mem0 CLI (Interactive) Source: https://github.com/mem0ai/mem0/blob/main/docs/platform/cli.mdx Run the interactive setup wizard to configure API key and user ID. ```bash mem0 init ``` -------------------------------- ### Start Docker Compose Stack Only Source: https://github.com/mem0ai/mem0/blob/main/docs/open-source/features/rest-api.mdx Start the Docker Compose stack without bootstrapping. Setup can be completed via the browser wizard. ```bash cd server docker compose up -d ``` -------------------------------- ### Start Mintlify Development Server Source: https://github.com/mem0ai/mem0/blob/main/docs/README.md Run the Mintlify development server to preview documentation changes locally. Execute this command from the root directory of your documentation project where the mint.json configuration file is located. ```bash mintlify dev ``` -------------------------------- ### Start Development Server Source: https://github.com/mem0ai/mem0/blob/main/docs/cookbooks/companions/quickstart-demo.mdx Launch the Next.js development server to run the demo application locally. ```bash pnpm run dev ``` -------------------------------- ### Mermaid Flowchart Diagram Example Source: https://github.com/mem0ai/mem0/blob/main/docs/templates/concept_guide_template.mdx An example Mermaid code block demonstrating how to embed a simple flowchart diagram within an MDX concept guide. This placeholder illustrates the syntax for defining inputs, concepts, and outcomes to visually explain a process or architecture. ```mermaid graph LR A[Input] */} B[Concept] B */} C[Outcome] ``` -------------------------------- ### mem0 identify Command Examples Source: https://github.com/mem0ai/mem0/blob/main/skills/mem0-cli/references/command-reference.md These examples show how to tag an active Agent Mode key with a specific AI agent identity after initial setup. ```bash mem0 identify claude-code ``` ```bash mem0 identify cursor ``` ```bash mem0 identify my-custom-bot ``` -------------------------------- ### Install Cassandra on macOS with Homebrew Source: https://github.com/mem0ai/mem0/blob/main/docs/components/vectordbs/dbs/cassandra.mdx Install Apache Cassandra on macOS using Homebrew package manager. Installs Cassandra, starts the service via Homebrew services, and connects to the CQL shell for database interaction. ```bash # Using Homebrew brew install cassandra # Start Cassandra brew services start cassandra # Connect to CQL shell cqlsh ``` -------------------------------- ### Complete Example with Multiple File Types Source: https://github.com/mem0ai/mem0/blob/main/docs/platform/features/multimodal-support.mdx Comprehensive example demonstrating how to add image URLs, text document URLs, and PDF URLs to Mem0 memory in a single workflow. Requires MemoryClient initialization and base64 module import. ```python import base64 from mem0 import MemoryClient client = MemoryClient() def file_to_base64(file_path): with open(file_path, "rb") as file: return base64.b64encode(file.read()).decode('utf-8') # Example 1: Using an image URL image_message = { "role": "user", "content": { "type": "image_url", "image_url": { "url": "https://example.com/sample-image.jpg" } } } # Example 2: Using a text document URL text_message = { "role": "user", "content": { "type": "mdx_url", "mdx_url": { "url": "https://www.w3.org/TR/2003/REC-PNG-20031110/iso_8859-1.txt" } } } # Example 3: Using a PDF URL pdf_message = { "role": "user", "content": { "type": "pdf_url", "pdf_url": { "url": "https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf" } } } # Add each message to the memory system client.add([image_message], user_id="alice") client.add([text_message], user_id="alice") client.add([pdf_message], user_id="alice") ``` -------------------------------- ### Start Mem0 Self-Hosted Server Manually Source: https://github.com/mem0ai/mem0/blob/main/README.md Manually start the Mem0 self-hosted server stack. Setup can be completed via the browser wizard at http://localhost:3000. ```bash cd server && docker compose up -d # http://localhost:3000 ``` -------------------------------- ### Python Minimal Code Snippet Example Source: https://github.com/mem0ai/mem0/blob/main/docs/templates/concept_guide_template.mdx A placeholder for a minimal Python code snippet intended to anchor a concept in practical implementation. This block serves as an example of how to include relevant code to illustrate the concept's usage or core logic within an MDX guide. ```python # Minimal snippet that anchors the concept in code ``` -------------------------------- ### Install mem0-ts Project Dependencies Source: https://github.com/mem0ai/mem0/blob/main/mem0-ts/src/oss/README.md Provides instructions for cloning the repository, installing Node.js dependencies, setting up environment variables, and building the project for initial setup. ```bash git clone cd mem0-ts ``` ```bash npm install ``` ```bash cp .env.example .env # Edit .env with your OpenAI API key ``` ```bash npm run build ``` -------------------------------- ### Run Mintlify development server Source: https://github.com/mem0ai/mem0/blob/main/docs/contributing/documentation.mdx Start the Mintlify development server from the docs/ directory to preview documentation locally at http://localhost:3000. ```bash mintlify dev ``` -------------------------------- ### OpenClaw Plugin Initial Setup Source: https://github.com/mem0ai/mem0/blob/main/CLAUDE.md Installs dependencies for the OpenClaw plugin using pnpm. ```bash cd integrations/openclaw && pnpm install ``` -------------------------------- ### Interactive Setup Wizard for Mem0 Source: https://github.com/mem0ai/mem0/blob/main/docs/integrations/hermes.mdx Run the interactive setup wizard to configure Mem0 as the memory provider. Select mem0 when prompted and enter your API key; configuration is saved to ~/.hermes/mem0.json. ```bash hermes memory setup ``` -------------------------------- ### Clone and Setup Memory Benchmarks Repository Source: https://github.com/mem0ai/mem0/blob/main/AGENTS.md Clones the external memory-benchmarks repository and installs its Python dependencies. ```bash git clone https://github.com/mem0ai/memory-benchmarks.git cd memory-benchmarks pip install -r requirements.txt ``` -------------------------------- ### Set up CLI development environment Source: https://github.com/mem0ai/mem0/blob/main/cli/python/README.md Install the CLI in editable mode and run it directly from the source for development purposes. ```bash cd cli/python python -m venv .venv && source .venv/bin/activate pip install -e ".[dev]" # Run during development python -m mem0_cli --help mem0 add "test memory" --user-id alice ``` -------------------------------- ### Initialize Mem0 client with authentication Source: https://github.com/mem0ai/mem0/blob/main/docs/integrations/langchain-tools.mdx Import dependencies and set up the MemoryClient with API key authentication. ```python from langchain_core.tools import StructuredTool from mem0 import MemoryClient from pydantic import BaseModel, Field from typing import List, Dict, Any, Optional import os os.environ["MEM0_API_KEY"] = "your-api-key" client = MemoryClient() ``` -------------------------------- ### Main Function to Plan a Trip and Example Usage Source: https://github.com/mem0ai/mem0/blob/main/docs/integrations/crewai.mdx Implement the main `plan_trip` function orchestrating agent and task creation, crew setup, and execution. Includes an example of how to call the function to plan a trip to San Francisco. ```python def plan_trip(destination: str, user_id: str): # Create agent travel_agent = create_travel_agent() # Create task planning_task = create_planning_task(travel_agent, destination) # Setup crew crew = setup_crew([travel_agent], [planning_task]) # Execute and return results return crew.kickoff() # Example usage if __name__ == "__main__": result = plan_trip("San Francisco", "crew_user_1") print(result) ``` -------------------------------- ### Run Multi-Session Learning Agent Example Source: https://github.com/mem0ai/mem0/blob/main/docs/cookbooks/frameworks/llamaindex-multiagent.mdx Demonstrates a complete learning workflow with two sessions where memory persists between them, followed by retrieval of learning history. Shows how the system remembers student context across sessions. ```python async def run_learning_agent(): learning_system = MultiAgentLearningSystem(student_id="Alexander") # First session print("Session 1:") response = await learning_system.start_learning_session( "Vision Language Models", "I'm new to machine learning but I have good hold on Python and have 4 years of work experience.") print(response) # Second session - multi-agent memory will remember the first print("\nSession 2:") response2 = await learning_system.start_learning_session( "Machine Learning", "what all did I cover so far?") print(response2) # Show what the multi-agent system remembers print("\nLearning History:") history = await learning_system.get_learning_history() print(history) ``` -------------------------------- ### Bootstrap admin account from command line Source: https://github.com/mem0ai/mem0/blob/main/docs/open-source/setup.mdx Starts containers and automatically creates the admin account and API key via CLI without browser interaction. Requires a valid LLM provider key in server/.env. ```bash cd server make bootstrap ``` ```bash make bootstrap EMAIL=admin@company.com PASSWORD='strong-password' NAME='Admin' ``` -------------------------------- ### MDX Concept Guide Template Structure Source: https://github.com/mem0ai/mem0/blob/main/docs/templates/concept_guide_template.mdx A comprehensive MDX template for authoring concept guides, defining the standard structure from frontmatter to call-to-action components. It includes placeholders for definitions, key terms, diagrams, code examples, and comparative tables to ensure consistent and effective documentation. ```mdx --- title: [Concept name] description: [One-sentence promise of understanding] icon: "lightbulb" --- # [Concept headline] [Define the concept in one sentence.] [Add an analogy or context hook.] **Why it matters** - [Impact bullet] - [Impact bullet] - [Impact bullet] ## Key terms - **[Term]** – [Short definition] - **[Term]** – [Short definition] {/* Optional: delete if not needed */} ```mermaid graph LR A[Input] */} B[Concept] B */} C[Outcome] ``` ## How does it work? [Explain lifecycle or architecture.] ```python # Minimal snippet that anchors the concept in code ``` [Nuance or best practice related to this concept.] ## When should you use it? - [Scenario 1] - [Scenario 2] - [Scenario 3] ## How it compares | Option | Best for | Trade-offs | | --- | --- | --- | | [Concept] | [Use case] | [Caveat] | | [Alternative] | [Use case] | [Caveat] | [Optional limitation or beta note.] Delete if not needed. ## Put it into practice - [Operation or feature doc that relies on this concept] - [Another supporting doc] ## See it live - [Cookbook or integration demonstrating the concept] - [Recording, demo, or sample repo] {/* DEBUG: verify CTA targets */} ``` -------------------------------- ### Cookbook Setup Source: https://github.com/mem0ai/mem0/blob/main/docs/templates/cookbook_template.mdx Initial setup for the cookbook, including language configuration and placeholder imports. This section should mention any prerequisites like API keys or environment variables. ```python default_language = "python" # replace with real imports ``` ```typescript // Equivalent TypeScript setup goes here ``` -------------------------------- ### Python Client Search Configuration Example Source: https://github.com/mem0ai/mem0/blob/main/docs/templates/feature_guide_template.mdx Python code snippet demonstrating how to initialize a Mem0 client and perform a search with criteria filters for advanced retrieval functionality. ```python client = Client(...) client.memories.search(criteria={...}) ``` -------------------------------- ### Vercel AI SDK Provider Initial Setup Source: https://github.com/mem0ai/mem0/blob/main/CLAUDE.md Installs dependencies for the Vercel AI SDK provider using pnpm. ```bash cd integrations/vercel-ai-sdk && pnpm install ``` -------------------------------- ### Install Dependencies and Build Project Source: https://github.com/mem0ai/mem0/blob/main/integrations/pi-agent-plugin/README.md Commands to install project dependencies, perform type checking, run tests, and build the project for development. ```bash pnpm install # Install dependencies pnpm run typecheck # Type check pnpm run test # Run tests pnpm run build # Build (ESM + declarations) ``` -------------------------------- ### Set up Agent Session and Entrypoint Source: https://github.com/mem0ai/mem0/blob/main/docs/integrations/livekit.mdx This code defines the main entrypoint for the agent, configuring the LiveKit session with various speech and language models, and starting the `MemoryEnabledAgent`. ```python async def entrypoint(ctx: JobContext): """Main entrypoint for the agent.""" await ctx.connect() session = AgentSession( stt=deepgram.STT(), llm=openai.LLM(model="gpt-5-mini"), tts=openai.TTS(voice="ash",), turn_detection=EnglishModel(), vad=silero.VAD.load(), ) await session.start( agent=MemoryEnabledAgent(), room=ctx.room, room_input_options=RoomInputOptions( noise_cancellation=noise_cancellation.BVC(), ), ) # Initial greeting await session.generate_reply( instructions="Greet the user warmly as George the travel guide and ask how you can help them plan their next adventure.", allow_interruptions=True ) # Run the application if __name__ == "__main__": cli.run_app(WorkerOptions(entrypoint_fnc=entrypoint)) ``` -------------------------------- ### Build Project Documentation Source: https://github.com/mem0ai/mem0/blob/main/CLAUDE.md Command to build the project documentation using Mintlify. ```bash make docs # or: cd docs && mintlify dev ``` -------------------------------- ### Get Single Configuration Value Source: https://github.com/mem0ai/mem0/blob/main/skills/mem0-cli/references/command-reference.md Examples for retrieving specific configuration values using their dotted key paths, such as API keys or default user IDs. ```bash mem0 config get platform.api_key ``` ```bash mem0 config get defaults.user_id ``` -------------------------------- ### Install mem0-vercel-ai-sdk Reference Skill Source: https://github.com/mem0ai/mem0/blob/main/skills/README.md Install the mem0-vercel-ai-sdk reference skill for projects using the @mem0/vercel-ai-provider and createMem0. ```bash npx skills add https://github.com/mem0ai/mem0 --skill mem0-vercel-ai-sdk ``` -------------------------------- ### Setup Pre-commit Hooks Source: https://github.com/mem0ai/mem0/blob/main/docs/contributing/development.mdx Install and configure pre-commit hooks to automatically run code quality checks before each commit. This ensures code standards are maintained across all contributions. ```bash pre-commit install ``` -------------------------------- ### Initialize Mem0 with DeepSeek LLM Source: https://github.com/mem0ai/mem0/blob/main/docs/components/llms/models/deepseek.mdx Setup Mem0 to use DeepSeek by configuring environment variables and model parameters. This example shows how to add messages to memory with specific user metadata. ```python import os from mem0 import Memory os.environ["DEEPSEEK_API_KEY"] = "your-api-key" os.environ["OPENAI_API_KEY"] = "your-api-key" # for embedder model config = { "llm": { "provider": "deepseek", "config": { "model": "deepseek-chat", # default model "temperature": 0.2, "max_tokens": 2000, "top_p": 1.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 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", metadata={"category": "movies"}) ```