#7352·mem0

docs: Python multimodal examples recreate clients with vision disabled

Author: dayangtuo836Created Sep 17, 2026Updated Sep 17, 2026
Labelsdocumentationsdk-python

Component

Other — OSS Python documentation

Description

Summary

The OSS multimodal guide explains that Python requires enable_vision=True, but its four standalone Python examples subsequently initialize client = Memory(). This replaces the vision-enabled client, so image content is skipped during preprocessing.

The affected examples are URL images, base64 images, restaurant menus, and error handling. The base64 example retains its text part but does not describe the image.

Steps to Reproduce

At commit 0df3e4b87df20785f0741370c75e44428796193e, compare the initial warning's configuration with those four constructors. The following offline script isolates the actual SDK parser behavior; run it from the repository root with Python. It uses the source functions unchanged and a fake LLM, so no API key, image download, or vector store is needed.

"""Run from the repository root. No dependencies or network calls required."""
import ast
from pathlib import Path
from unittest.mock import Mock

path = Path('mem0/memory/utils.py')
tree = ast.parse(path.read_text(encoding='utf-8'))
functions = [node for node in tree.body if isinstance(node, ast.FunctionDef)
             and node.name in {'get_image_description', 'parse_vision_messages'}]
namespace = {}
exec(compile(ast.Module(body=functions, type_ignores=[]), str(path), 'exec'), namespace)
parse = namespace['parse_vision_messages']
messages = [{'role': 'user', 'content': {'type': 'image_url', 'image_url': {'url': 'https://example.com/menu.jpg'}}}]
llm = Mock()
llm.generate_response.return_value = 'OFFLINE_IMAGE_DESCRIPTION'
print('Without vision:', parse(messages))
print('With vision:', parse(messages, llm, 'auto'))
print('Vision model calls:', llm.generate_response.call_count)

Expected Behavior

The Python examples should configure the vision-enabled client described by the guide so image messages reach the vision model.

Actual Behavior

The default client takes the no-LLM preprocessing branch in Memory.add(). Image-only content disappears; text parts can remain.

Environment

  • Repository: mem0ai/mem0, commit 0df3e4b87df20785f0741370c75e44428796193e
  • Python: 3.14.0 (standard-library-only source reproduction; full SDK not installed)
  • OS: Windows

How You Verified This

What I Ran

Codex ran the script above and an offline check of all four Python examples against the actual Memory.add() vision dispatch and parser functions.

What I Saw

Without vision: []
With vision: [{'role': 'user', 'content': 'OFFLINE_IMAGE_DESCRIPTION'}]
Vision model calls: 1

All four original examples made zero vision calls in the offline check. All four made one after explicitly enabling vision. This verifies preprocessing, not end-to-end memory creation or live model responses.

Why This Is a Bug

The same page says image-derived information should be included, but its client initialization omits the required setting. The Python SDK intentionally drops image content when vision is disabled.

What I Ruled Out

  • This occurs before image downloading or vector-store access.
  • #5847 added the warning but left these constructors unchanged.
  • Open/closed Issue and PR searches plus a file inventory of all 440 open PRs found no matching fix as of 2026-09-17. The only open PR touching this page, #6710, changes its title/sidebar metadata.

Proposed fix: explicitly enable vision in the four Python constructors and clarify that the flag requirement applies to Python. No SDK behavior change.

AI Assistance

AI found and wrote this, and I have not reproduced it myself.

Codex found the discrepancy and executed the checks above. Independent human reproduction is not claimed.