Repository navigation
Add simple app & query functionality - #1
Merged
Merged
Conversation
This commit enables anyone to create a app and add 3 types of data sources: * pdf file * youtube video * website It exposes a function called query which first gets similar docs from vector db and then passes it to LLM to get the final answer.
Adds a base chunker from which any chunker can inherit. Existing chunkers are refactored to inherit from this base chunker.
raghavtyagii
pushed a commit
to raghavtyagii/embedchain
that referenced
this pull request
Sep 25, 2023
merlinfrombelgium
pushed a commit
to merlinfrombelgium/mem0
that referenced
this pull request
Jul 4, 2025
Add simple app & query functionality
xiangnuans
added a commit
to xiangnuans/mem0
that referenced
this pull request
Dec 5, 2025
add openrouter and deepinfra llm
ywmail
added a commit
to ywmail/mem0
that referenced
this pull request
Jan 19, 2026
[TicketNo.] US20251217073371 mem0ai#1 [Binary Source] NA
This was referenced Feb 17, 2026
7 tasks done
utkarsh240799
added a commit
that referenced
this pull request
Mar 13, 2026
- Add user identity to extraction preamble so memories are attributed to the correct user instead of cross-referencing cached patterns (OPE-6 #1) - Skip mem0.add() when no user messages remain after noise filtering, avoiding wasted API calls on assistant-only payloads (OPE-6 #2) - Raise auto-recall threshold to 0.6 (vs 0.5 for explicit search) and add dynamic thresholding that drops memories below 50% of the top result's score to reduce irrelevant context injection (OPE-6 #3) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
utkarsh240799
added a commit
that referenced
this pull request
Mar 16, 2026
- Add user identity to extraction preamble so memories are attributed to the correct user instead of cross-referencing cached patterns (OPE-6 #1) - Skip mem0.add() when no user messages remain after noise filtering, avoiding wasted API calls on assistant-only payloads (OPE-6 #2) - Raise auto-recall threshold to 0.6 (vs 0.5 for explicit search) and add dynamic thresholding that drops memories below 50% of the top result's score to reduce irrelevant context injection (OPE-6 #3) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
utkarsh240799
added a commit
that referenced
this pull request
Mar 16, 2026
- Add user identity to extraction preamble so memories are attributed to the correct user instead of cross-referencing cached patterns (OPE-6 #1) - Skip mem0.add() when no user messages remain after noise filtering, avoiding wasted API calls on assistant-only payloads (OPE-6 #2) - Raise auto-recall threshold to 0.6 (vs 0.5 for explicit search) and add dynamic thresholding that drops memories below 50% of the top result's score to reduce irrelevant context injection (OPE-6 #3) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
VictorECDSA
added a commit
to VictorECDSA/mem0
that referenced
this pull request
Mar 23, 2026
…operations # Fixes mem0ai#4490: Preserve original `actor_id` during memory UPDATE operations Fixes mem0ai#4490 ## Summary This PR attempts to fix an issue where `actor_id` metadata gets overwritten during UPDATE operations, breaking actor-level memory isolation in multi-actor scenarios. I've tested this fix locally and it seems to resolve the problem, but I would greatly appreciate maintainer review to ensure it aligns with the project's design goals. **Changes**: - Modified `_update_memory()` in `mem0/memory/main.py` (lines 1251-1252 and 2347-2349) - Changed conditional preservation to unconditional preservation of original `actor_id` ## Problem Statement Please see issue mem0ai#4490 for full details on the problem. **Quick summary**: When using `metadata={"actor_id": ...}` with shared `user_id` in multi-actor scenarios, the `actor_id` field appears to be overwritten when a different actor triggers an UPDATE event: ```python # Actor A creates memory m.add([{"role": "user", "content": "I am player mem0ai#1"}], user_id="team", metadata={"actor_id": "Alice"}) # ✓ Memory created with actor_id="Alice" # Actor B updates A's memory m.add([{"role": "user", "content": "Player mem0ai#1 is a good person"}], user_id="team", metadata={"actor_id": "Bob"}) # ❌ Memory updated but actor_id becomes "Bob" # Query fails m.search(query="", filters={"actor_id": "Alice"}) # Returns empty! ``` **Impact**: 1. Cannot query by original creator after UPDATE 2. Memory ownership tracking lost 3. Actor isolation fails in shared `user_id` scenarios ## Changes Made ### Code Changes **File**: `mem0/memory/main.py` **Location**: - Lines 1251-1252 (sync version of `_update_memory`) - Lines 2347-2348 (async version of `_update_memory`) **Before**: ```python if "actor_id" not in new_metadata and "actor_id" in existing_memory.payload: new_metadata["actor_id"] = existing_memory.payload["actor_id"] ``` **After**: ```python if "actor_id" in existing_memory.payload: new_metadata["actor_id"] = existing_memory.payload["actor_id"] ``` **Rationale**: Based on my investigation, it appears the condition check always evaluates to `False` because `new_metadata` contains the current actor's ID (passed from line 1668/1662). Removing this condition seems to make `actor_id` preservation work as (I believe) intended. This change treats `actor_id` as **"memory owner"** rather than **"last updater"**. The history table already tracks all contributors via `db.add_history()`, so update history is preserved. ## Testing ### Test Methodology I've attempted to validate this fix using a monkey patch approach that applies the proposed change to my local codebase without modifying source files. This allowed me to test the behavior before submitting the PR. ### Before Fix (Bug Demonstration) **Test scenario**: Alice creates a memory, Bob updates it with different `actor_id` **Result**: ``` === State AFTER Bob's UPDATE === Event: UPDATE This actor_id: 'Bob' ← Overwritten! ISOLATION TEST: Query Alice's memories: 0 found ❌ BUG: Alice's memory lost! ``` ### After Fix (Monkey Patch Validation) **Applied patch**: ```python from mem0.memory.main import Memory as MemoryClass def _patched_update_memory(self, memory_id, data, existing_embeddings, metadata=None): # ... (identical to original except actor_id handling) # ===== FIX ===== if "actor_id" in existing_memory.payload: new_metadata["actor_id"] = existing_memory.payload["actor_id"] # =============== # ... (rest unchanged) MemoryClass._update_memory = _patched_update_memory ``` **Result**: ``` === State AFTER Bob's UPDATE === Event: UPDATE This actor_id: 'Alice' ← Preserved! ISOLATION TEST: Query Alice's memories: 1 found ✅ SUCCESS: Alice's memory preserved! ``` ### Key Verification Points ✅ UPDATE event correctly triggered (not ADD) ✅ Memory content correctly updated ✅ `actor_id` preserved as original creator ✅ Query filtering by `actor_id` works correctly ✅ No side effects on other metadata fields ## Backward Compatibility To the best of my understanding, this change should not introduce breaking changes: - Existing code should continue to work without modification - API signature remains unchanged - Only affects behavior in multi-actor UPDATE scenarios - History table continues to track all contributors However, I may be missing some edge cases, so maintainer review would be greatly appreciated! ### Behavior Change Details **Before this fix:** When calling `add()` with a different `actor_id` that triggers an UPDATE event, the `actor_id` would be overwritten to the new actor. **After this fix:** The original `actor_id` (memory creator) is preserved during UPDATE operations. **Scenarios NOT affected:** - ✅ Calling `update()` method directly (already preserves `actor_id` correctly) - ✅ Updating memories without `actor_id` field (behavior unchanged) - ✅ Adding new memories (no UPDATE event triggered) **If you were relying on UPDATE to change `actor_id`:** You should use this pattern instead: ```python # Delete the old memory m.delete(memory_id) # Add a new memory with new actor m.add(..., metadata={"actor_id": "new_actor"}) ``` This change aligns with the semantic meaning of `actor_id` as the **memory creator** (immutable), not the **last updater** (tracked in history table). ## Additional Context ### Design Consistency This fix aligns with how other session identifiers are handled: ```python # Lines 1245-1250 already preserve these unconditionally (if not in new_metadata): if "user_id" not in new_metadata and "user_id" in existing_memory.payload: new_metadata["user_id"] = existing_memory.payload["user_id"] if "agent_id" not in new_metadata and "agent_id" in existing_memory.payload: new_metadata["agent_id"] = existing_memory.payload["agent_id"] if "run_id" not in new_metadata and "run_id" in existing_memory.payload: new_metadata["run_id"] = existing_memory.payload["run_id"] ``` The fix makes `actor_id` follow the same preservation pattern, but removes the always-false condition. ### Alternative Approaches I Considered I also thought about these alternatives, but decided against them (open to feedback though!): 1. **Track both `created_by` and `updated_by`** - Would require more complex schema changes - Less backward-compatible - Might not be necessary since history table already tracks updates 2. **Make preservation configurable** - Would add API complexity - I couldn't think of a clear use case for wanting `actor_id` to change - Seems to go against the semantic meaning of "actor" If either of these approaches seems better, I'm happy to revise the PR! ### Affected Implementations - ✅ Sync: `_update_memory()` (lines 1251-1252) - ✅ Async: `async _update_memory()` (lines 2347-2349) ## Checklist - [x] Code changes implemented (both sync and async) - [x] Tested with before/after comparison (monkey patch validation) - [x] Verified backward compatibility (to the best of my understanding) - [x] No breaking changes to existing API (as far as I can tell) - [x] Documented in PR description - [ ] Unit tests added (awaiting maintainer guidance on test location/structure) --- **Environment**: - Mem0 version: v1.0.7 - Python: 3.13 - Vector Store: Qdrant (local) Happy to make any adjustments based on maintainer feedback. Thanks for the great library!
11 tasks done
8 tasks done
Closed
blazingretinol
added a commit
that referenced
this pull request
Jun 5, 2026
- require_admin: handle ADMIN_API_KEY and AUTH_DISABLED on fresh empty DB by falling through to allow bootstrap when no users exist yet, instead of raising 401 (Finding #1) - docker-compose healthcheck: use ${POSTGRES_USER:-postgres} instead of hardcoded -U postgres so custom POSTGRES_USER values work (Finding #2) - require_admin: restore request: Request param (needed for auth_type check) but now used in function body (Finding #7 resolved) - docs: sync migration guide password placeholder with README (Finding #9)
This was referenced Jun 8, 2026
8 tasks done
7 of 14 tasks
This was referenced Jun 22, 2026
This was referenced Jul 2, 2026
10 of 18 tasks
8 of 14 tasks
7 of 14 tasks
8 of 14 tasks
6 of 7 tasks
cornyum
added a commit
to cornyum/mem0
that referenced
this pull request
Aug 16, 2026
内核 review(3 critical / 7 major / 4 minor): - mem0ai#1 孤儿清扫改为单文档删除 + 宽限期 + 删前水位复核——不再整条 删除 entry 的已发布版本历史,且不会击中在途发布 - mem0ai#2 _state_flip 每轮 CAS 重读 head:并发 revise 后的 retire/reactivate 翻转最新状态,不再用陈旧快照回退已发布版本 - mem0ai#3 并发 revise 冲突后重算版本号:确定性 version _id 不再覆盖已发布 不可变版本(expand 证据链保持有效) - mem0ai#4 对账校验改为存在且匹配:陈旧 head 从已发布 version 重建; 事件 state_after 由水位事件推导(不再被陈旧 head 污染) - mem0ai#5 恢复路径用 version 文档的实际 scope_revision(claim 记录的是预测值) - mem0ai#6 已发布但 dedup 未落盘的 claim 补 ACTIVE 而非释放(防重复创建) - mem0ai#7 _get_doc 区分 404 与瞬时故障(防误判触发 claim 接管) - mem0ai#8 claim 接管围栏:最终 ACTIVE 写入前校验归属;reactivate 尊重 TTL - mem0ai#9 EmbeddingReconciler 条件向量写入(entry_version_id 围栏, 防 revise 竞态把旧向量盖章 ready) - mem0ai#10 purge 物理删除纳入派生重试 + 对账补齐(purged 水位触发清理) - mem0ai#11 SQL 兜底要求全部通道失败均为 UNAVAILABLE/TIMEOUT/THROTTLED (单个 400/401 类失败一票否决,防止配置错误被静默降级) - mem0ai#12 写者确定性失败时释放自己的 prepared claim(重试立即收敛) - mem0ai#14 alias 守卫改为别名级(防 v2 切换后双索引绑定) 新增 7 项并发/恢复回归测试(stale-head 翻转、双修订版本链、孤儿宽限、 陈旧 head 重建、条件向量、活 claim 补齐、兜底一票否决) 修复 FakeES NotFoundError 构造缺 body(此前被全捕获掩盖) E2E 复验: ONLY_VDB 36/36;全套件 820 通过
cornyum
added a commit
to cornyum/mem0
that referenced
this pull request
Aug 16, 2026
…1 minor) - mem0ai#1(CRITICAL) 迁移 backfill 改 search_after 分页扫描——不再静默截断 1000 行上限(防永久数据丢失) - mem0ai#2 迁移对账改为强断言:五索引 refresh + track_total_hits 计数, scope/head/version/active-dedup 数量不一致即 ok=false - mem0ai#3 HYBRID 下 ES 探针非阻塞——ES 故障 → degraded(SQL FTS 继续服务, §10 表格语义),ONLY_VDB 保持 not_ready - mem0ai#4 /configure 构建成功后才提交 _current_config(防幻影配置) - mem0ai#5 legacy get_all 过期过滤改为日期比较(未来过期日不再隐藏记忆) - mem0ai#6 metadata/expiration-only revise 不再被 noop 吞掉;支持清除过期 (clear_expires_at 语义贯通 adapter→service→write) - mem0ai#7 legacy /search 元数据过滤改为真过滤(不再伪造命中 metadata) - mem0ai#8 vector_store shim 补全 serialize 契约(expiration_date/categories) + after_id 键集分页(/export 超 500 行不再截断) - mem0ai#9 MCP 中间件仅凭证解析在错误作用域内(传输/工具错误不再伪装 401) - mem0ai#10 挂载式 /mcp 同样套 McpAuthMiddleware(宿主收养 lifespan 时不再 暴露无鉴权服务级 API) - mem0ai#11 custom_instructions/分类体系/legacy prompt 真正贯通到抽取 LLM - mem0ai#12 /configure 拓扑拒绝 → 400(不再 500) - mem0ai#13 EntryNotActiveError(409) 替代裸 ContextError(500) - mem0ai#14 legacy add 的 updated 收敛映射为 event=UPDATE - mem0ai#15 content_hash/expires_at 补入 head/recall 输出(hash 不再恒 null) - mem0ai#16 MCP expand 空范围防护 + 单条目工具暴露完整 scope 字段 - mem0ai#17 /metrics 加鉴权(admin/内网语义 §7.6.2) - mem0ai#18 Sunset 头改为 RFC 8594 日期 - mem0ai#19 overrides 读失败跳过持久化(不再清空已存配置) - mem0ai#20 backfill 单行容错+失败清单、CAS 单次取 scope、消除 O(n²) 辅助 - mem0ai#21 legacy delete_all 循环分页(不再 5000 静默截断) - mem0ai#22 admin migrate 改后台任务 + job 轮询端点 新增 5 项 legacy 契约回归测试;全套件 825 通过;ONLY_VDB e2e 复验 36/36
10 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This enables anyone to create an app and add 3 types of data sources:
• pdf file
• youtube video
• website
It exposes a function called query which first gets similar docs from vector db and then passes it to LLM to get the final answer.