mem0ai/mem0 · error · ValueError
Model '{model}' does not support function calling. Please us
Error message
Model '{model}' does not support function calling. Please use a model that supports function calling. What it means
Mem0Proxy checks litellm.supports_function_calling(model) before routing the request, because the proxy injects memory-management tools into the completion call. If litellm's model registry says the requested model cannot do function/tool calling, it raises ValueError immediately rather than sending a request that would fail obscurely at the provider.
Source
Thrown at mem0/proxy/main.py:101
parallel_tool_calls: Optional[bool] = None,
deployment_id=None,
extra_headers: Optional[dict] = None,
# soon to be deprecated params by OpenAI
functions: Optional[List] = None,
function_call: Optional[str] = None,
# set api_base, api_version, api_key
base_url: Optional[str] = None,
api_version: Optional[str] = None,
api_key: Optional[str] = None,
model_list: Optional[list] = None, # pass in a list of api_base,keys, etc.
):
if messages is None:
messages = []
if not any([user_id, agent_id, run_id]):
raise ValueError("One of user_id, agent_id, run_id must be provided")
if not litellm.supports_function_calling(model):
raise ValueError(
f"Model '{model}' does not support function calling. Please use a model that supports function calling."
)
prepared_messages = self._prepare_messages(messages)
if prepared_messages[-1]["role"] == "user":
self._async_add_to_memory(messages, user_id, agent_id, run_id, metadata, filters)
relevant_memories = self._fetch_relevant_memories(messages, user_id, agent_id, run_id, filters, top_k)
logger.debug(f"Retrieved {len(relevant_memories)} relevant memories")
prepared_messages[-1]["content"] = self._format_query_with_memories(messages, relevant_memories)
response = litellm.completion(
model=model,
messages=prepared_messages,
temperature=temperature,
top_p=top_p,
n=n,
timeout=timeout,
stream=stream,View on GitHub (pinned to 001c235229)
Solutions
- Use a model known to support function calling (e.g. gpt-4o, gpt-4o-mini, claude-3.5-sonnet, gemini-1.5-pro)
- Print litellm.supports_function_calling(model) in a quick REPL to see how litellm classifies your model string
- Upgrade litellm so newer models are recognized, or pass the fully qualified provider-prefixed name (e.g. 'azure/<deployment>') so lookup succeeds
- For local models, use a tool-calling-capable server (vLLM/Ollama with tools enabled) and the matching litellm provider prefix
Example fix
# before
resp = mem0_proxy.completion(messages=messages, model="some-base-model", user_id="alice")
# after
import litellm
assert litellm.supports_function_calling("gpt-4o-mini")
resp = mem0_proxy.completion(messages=messages, model="gpt-4o-mini", user_id="alice") Defensive patterns
Strategy: validation
Validate before calling
import litellm
if not litellm.supports_function_calling(model):
raise ValueError(f"{model} cannot be used with the mem0 proxy; pick a tool-capable model") Prevention
- Check litellm.supports_function_calling in a startup self-test for every model you route through the proxy
- Keep litellm updated when adopting new models
- Use fully qualified provider-prefixed model strings
When it happens
Trigger: Passing a chat-only or completion-only model name (e.g. some base/instruct models, older tiers, or unknown custom model strings) to mem0_proxy.completion(); typos in model names that make litellm fall back to a registry entry without function-calling support; using a custom 'openai/<deployed-name>' style string litellm cannot classify.
Common situations: Switching from gpt-4o to a cheaper/local model (e.g. some llama variants) that lacks tool support; on-prem deployments with custom model names litellm maps conservatively; litellm version changes that alter the supports_function_calling table.
Related errors
- LiteLLM failed: ${message}
- One of user_id, agent_id, run_id must be provided
- Invalid response format from ping endpoint
- NET_CONNECT
AI-assisted analysis of mem0ai/mem0@001c235229 (2026-08-15).
Data as JSON: /api/errors/69125aaf4e68b2fa.
Report an issue: GitHub.