mem0ai/mem0 · error · ValueError

Model '{self.config.model}' in litellm does not support func

Error message

Model '{self.config.model}' in litellm does not support function calling.

What it means

Error "Model '{self.config.model}' in litellm does not support function calling." thrown in mem0ai/mem0.

Source

Thrown at mem0/llms/litellm.py:71

        messages: List[Dict[str, str]],
        response_format=None,
        tools: Optional[List[Dict]] = None,
        tool_choice: str = "auto",
    ):
        """
        Generate a response based on the given messages using Litellm.

        Args:
            messages (list): List of message dicts containing 'role' and 'content'.
            response_format (str or object, optional): Format of the response. Defaults to "text".
            tools (list, optional): List of tools that the model can call. Defaults to None.
            tool_choice (str, optional): Tool choice method. Defaults to "auto".

        Returns:
            str: The generated response.
        """
        if tools and not litellm.supports_function_calling(self.config.model):
            raise ValueError(f"Model '{self.config.model}' in litellm does not support function calling.")

        params = {
            "model": self.config.model,
            "messages": messages,
            "temperature": self.config.temperature,
            "top_p": self.config.top_p,
        }
        if self._uses_max_completion_tokens(self.config.model):
            params["max_completion_tokens"] = self.config.max_tokens
        else:
            params["max_tokens"] = self.config.max_tokens
        if response_format:
            params["response_format"] = response_format
        if tools:  # TODO: Remove tools if no issues found with new memory addition logic
            params["tools"] = tools
            params["tool_choice"] = tool_choice

        response = litellm.completion(**params)

View on GitHub (pinned to 001c235229)

Solutions

  1. Choose a litellm model that supports function calling, or disable tools in the request.

When it happens

Trigger: Thrown at mem0/llms/litellm.py:71 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/17f5aa3996871a69. Report an issue: GitHub.