Back to Mem0

Overview

docs/components/llms/overview.mdx

2.0.123.6 KB
Original Source

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

To use an LLM, you must provide a configuration to customize its usage. If no configuration is supplied, a default configuration will be applied, and OpenAI will be used as the LLM.

For a comprehensive list of available parameters for llm configuration, please refer to Config.

Supported LLMs

See the list of supported LLMs below.

<Note> All LLMs are supported in Python. The following LLMs are also supported in TypeScript: **OpenAI**, **Anthropic**, **AWS Bedrock**, **Groq**, **Azure OpenAI**, **DeepSeek**, **Google AI**, **Langchain**, **LM Studio**, **Mistral AI**, and **Ollama**. </Note> <CardGroup cols={4}> <Card title="OpenAI" icon="/images/provider-icons/openai.svg" href="/components/llms/models/openai" /> <Card title="Ollama" icon="/images/provider-icons/ollama.svg" href="/components/llms/models/ollama" /> <Card title="Azure OpenAI" icon="/images/provider-icons/azure-color.svg" href="/components/llms/models/azure_openai" /> <Card title="Anthropic" icon="/images/provider-icons/anthropic.svg" href="/components/llms/models/anthropic" /> <Card title="Together" icon="/images/provider-icons/together-color.svg" href="/components/llms/models/together" /> <Card title="Groq" icon="/images/provider-icons/groq.svg" href="/components/llms/models/groq" /> <Card title="Litellm" icon="shuffle" href="/components/llms/models/litellm" /> <Card title="Mistral AI" icon="/images/provider-icons/mistral-color.svg" href="/components/llms/models/mistral_AI" /> <Card title="Google AI" icon="/images/provider-icons/google-color.svg" href="/components/llms/models/google_AI" /> <Card title="AWS bedrock" icon="/images/provider-icons/bedrock-color.svg" href="/components/llms/models/aws_bedrock" /> <Card title="DeepSeek" icon="/images/provider-icons/deepseek-color.svg" href="/components/llms/models/deepseek" /> <Card title="MiniMax" icon="/images/provider-icons/minimax-color.svg" href="/components/llms/models/minimax" /> <Card title="xAI" icon="/images/provider-icons/xai.svg" href="/components/llms/models/xAI" /> <Card title="Sarvam AI" icon="/images/provider-icons/sarvam.svg" href="/components/llms/models/sarvam" /> <Card title="LM Studio" icon="/images/provider-icons/lmstudio.svg" href="/components/llms/models/lmstudio" /> <Card title="Langchain" icon="/images/provider-icons/langchain-color.svg" href="/components/llms/models/langchain" /> </CardGroup>

Structured vs Unstructured Outputs

Mem0 supports two types of OpenAI LLM formats, each with its own strengths and use cases:

Structured Outputs

Structured outputs are LLMs that align with OpenAI's structured outputs model:

  • Optimized for: Returning structured responses (e.g., JSON objects)
  • Benefits: Precise, easily parseable data
  • Ideal for: Data extraction, form filling, API responses
  • Learn more: OpenAI Structured Outputs Guide

Unstructured Outputs

Unstructured outputs correspond to OpenAI's standard, free-form text model:

  • Flexibility: Returns open-ended, natural language responses
  • Customization: Use the response_format parameter to guide output
  • Trade-off: Less efficient than structured outputs for specific data needs
  • Best for: Creative writing, explanations, general conversation

Choose the format that best suits your application's requirements for optimal performance and usability.