Skip to content

add scoped memory inference controls - #49

Open
HatsuneMiku333999 wants to merge 5 commits into
beersoccer:mainfrom
HatsuneMiku333999:dev/v0.3.2
Open

HatsuneMiku333999 wants to merge 5 commits into
beersoccer:mainfrom
HatsuneMiku333999:dev/v0.3.2

Conversation

@HatsuneMiku333999

@HatsuneMiku333999 HatsuneMiku333999 commented Sep 3, 2026 •

Copy link
Copy Markdown

Summary

  • Add per-call infer control to add_memory, including raw conversation storage when inference is disabled
  • Support a per-call custom fact-extraction prompt without mutating shared Mem0 configuration
  • Keep user_id required while making agent_id backward compatible: omitted means the legacy user_id scope; supplied means strict user_id + agent_id isolation
  • Stabilize Mem0 initialization, provider validation, packaging dependencies, pgvector defaults, and runtime behavior
  • Support nonstandard response shapes from GLM and other OpenAI-compatible gateways

Why

Existing workflows commonly scope memories by user_id only, so requiring agent_id would break them. This keeps the old behavior by default while allowing callers to opt into a stricter namespace. For Dify workflows, a stable application app_id is the recommended value to pass as Mem0's agent_id; the same value must be used for related add, search, read, update, and delete operations. run_id remains optional and is used only for tracing.

Mem0's standard LLM parser expects an OpenAI-style choices[0].message response. Some GLM/OpenAI-compatible gateways instead return a plain string or mapping. The compatibility wrapper preserves the standard parser path and only falls back for those nonstandard response shapes, preventing valid GLM responses from failing during memory extraction.

Testing

  • 21 focused memory-scope, add-memory option, and overload-guard tests passed
  • Ruff checks passed for all files changed by the compatibility update
  • Python compilation and tool YAML parsing passed

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant