Getting Started
Core Features
How-To Guides
Configuration
Troubleshooting
Integrations
Mem0 enhances AI assistants and agents by integrating with Large Language Models (LLMs) to provide intelligent memory capabilities. To function, Mem0 relies on an LLM to generate responses and process information. This guide explains how to select and configure the LLM that Mem0 uses for its operations.
By default, Mem0 is configured to work with gpt-4.1-nano-2025-04-14 from OpenAI. However, you have the flexibility to choose a different model to better suit your application's needs, performance requirements, or cost considerations.
A Large Language Model (LLM) is a type of artificial intelligence program trained on vast amounts of text data. LLMs can understand, generate, and respond to human-like text, making them essential for AI applications like chatbots, content creation, and intelligent assistants. Mem0 leverages these models to provide context-aware and personalized interactions.
Mem0 integrates with various LLMs. When using the OpenAI client, you can specify which model to use for generating responses.
First, ensure you have the OpenAI client initialized in your application.
from openai import OpenAI
openai_client = OpenAI()When making a call to the OpenAI client to generate a chat completion, you can set the model parameter to your preferred OpenAI model. The default model is gpt-4.1-nano-2025-04-14.
For example, to use the default model:
The specific models available and their names are determined by the LLM provider (e.g., OpenAI). Always refer to your chosen provider's documentation for the most up-to-date list of available models and their identifiers.
Mem0 supports integration with a variety of Large Language Models beyond OpenAI. While the example above demonstrates model selection within the OpenAI client, the process for configuring other LLM providers will vary depending on the provider and their specific client libraries.
# ... (previous code)
response = openai_client.chat.completions.create(model="gpt-4.1-nano-2025-04-14", messages=messages)To use a different OpenAI model, simply change the string value for the model parameter:
# Example: Using a hypothetical 'gpt-3.5-turbo' model
response = openai_client.chat.completions.create(model="gpt-3.5-turbo", messages=messages)