mem0ai/mem0 · error · ValueError

`model` parameter is required

Error message

`model` parameter is required

What it means

Error "`model` parameter is required" thrown in mem0ai/mem0.

Source

Thrown at mem0/llms/langchain.py:18

from typing import Dict, List, Optional

from mem0.configs.llms.base import BaseLlmConfig
from mem0.llms.base import LLMBase

try:
    from langchain.chat_models.base import BaseChatModel
    from langchain_core.messages import AIMessage
except ImportError:
    raise ImportError("langchain is not installed. Please install it using `pip install langchain`")


class LangchainLLM(LLMBase):
    def __init__(self, config: Optional[BaseLlmConfig] = None):
        super().__init__(config)

        if self.config.model is None:
            raise ValueError("`model` parameter is required")

        if not isinstance(self.config.model, BaseChatModel):
            raise ValueError("`model` must be an instance of BaseChatModel")

        self.langchain_model = self.config.model

    def _parse_response(self, response: AIMessage, tools: Optional[List[Dict]]):
        """
        Process the response based on whether tools are used or not.

        Args:
            response: AI Message.
            tools: The list of tools provided in the request.

        Returns:
            str or dict: The processed response.
        """
        if not tools:

View on GitHub (pinned to 001c235229)

Solutions

  1. Pass an initialized Langchain chat model via the 'model' field in the LLM config.

When it happens

Trigger: Thrown at mem0/llms/langchain.py:18 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of mem0ai/mem0@001c235229 (2026-08-15). Data as JSON: /api/errors/41db7a6b6815d9b3. Report an issue: GitHub.