Commit Graph
126 Commits
Author SHA1 Message Date
chaithanyak42andClaude Opus 4.6 98ed2e9202 fix(ts-oss): isolate entity store from memory store when dbPath unset
Symptom: TS OSS `memory.search()` returns entity rows (fragment text
like "a fan of", "recommending thriller movies and") mixed in with
real memories. The broken rows have `hash: undefined` and
`createdAt: undefined` because they came from the entity store, not
the memory pipeline.

Root cause: `MemoryVectorStore` uses a single `vectors` SQLite table
and ignores `collectionName` internally. The entity store is created
as a parallel instance with `collectionName: "${name}_entities"` in
`memory/index.ts:193`, but both default to the same `dbPath`
(`~/.mem0/vector_store.db`) when the caller doesn't set one. Both
writers append to the same `vectors` table, so a search that reads
that table returns rows from both collections.

The existing mitigation at `memory/index.ts:199` (dbPath.replace) only
fires when `dbPath` is set explicitly. The default (unset) case fell
through with no isolation.

Fix: `getDefaultVectorStoreDbPath(collectionName?)` now derives the
default filename from the collection name
(`vector_store_${name}.db`). `MemoryVectorStore` passes
`config.collectionName` into the helper. Memory vs entity stores now
land in separate files automatically, even when the caller doesn't set
`dbPath`. Explicit `dbPath` users are unaffected — the existing
suffix-swap in `memory/index.ts` still handles them.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-14 18:36:46 +05:30
kartik-mem0 5e941e24c2 refactor: update search tests to use AND filter syntax and drop version param 2026-04-14 17:46:58 +05:30
kartik-mem0 c3f48d093e refactor: update MemoryClient to use entity options instead of filters 2026-04-14 17:13:52 +05:30
kartik-mem0 28cc8fcee4 refactor: update MemoryClient to use filters for entity parameters 2026-04-14 16:17:50 +05:30
kartik-mem0 133625bbc6 refactor: update MemoryClient to support snake_case filter keys and separate filters 2026-04-14 02:54:44 +05:30
Soumil RathiandClaude Opus 4.6 e93a81b6a0 fix: change integration test query from 'anything' to 'test search query'
The word 'anything' triggers a server-side 500 in the v3 search
endpoint's BM25/lemmatization pipeline.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-13 14:05:24 -07:00
Soumil Rathi 5de9bae84e Merge branch 'feat/v3-pipeline' of https://github.com/mem0ai/mem0 into feat/v3-pipeline 2026-04-13 13:53:46 -07:00
Soumil RathiandClaude Opus 4.6 9c01c895c1 fix: use camelCase eventId in crud integration test assertions
Client's snakeToCamelKeys converts the v3 response keys to camelCase.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-13 13:53:37 -07:00
chaithanyak42andClaude Opus 4.6 41e51491dd fix: resolve merge conflicts with upstream TS changes
Take team's upstream changes for search return type
(Promise<{results: Array<Memory>}>) and test assertions.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-14 02:20:07 +05:30
Soumil RathiandClaude Opus 4.6 2a5ffd0976 fix: update integration tests for v3 API responses
- crud.test.ts: add() returns {event_id, status} not an array
- search.test.ts: use snake_case user_id in filters for v3 compatibility

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-13 13:45:12 -07:00
Soumil RathiandClaude Opus 4.6 271de8eabf revert: keep waitForSearchResults options as Record<string, any>
Matches main. The type tightening was an unsolicited change.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-13 13:33:16 -07:00
Soumil RathiandClaude Opus 4.6 015aa2c866 fix: type waitForSearchResults options as SearchMemoryOptions
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-13 13:32:00 -07:00
Soumil RathiandClaude Opus 4.6 2da2ded2d8 fix: restore v3 search response format — return {results: [...]} not bare array
The v3 API returns {results: [...]} and the client should pass that
through without unwrapping. Updated return type to Promise<{results: Array<Memory>}>,
removed the unwrap logic, and fixed integration tests to access .results.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-13 13:25:25 -07:00
Soumil RathiandClaude Opus 4.6 0aa0f44ac4 fix: revert search return type to Array<Memory> (matches unwrap logic)
Someone else's changes unwrap the v3 envelope in the client,
so the return type should stay as Array<Memory> for consistency.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-13 13:20:25 -07:00
Soumil Rathi 7410d190fc Merge branch 'feat/v3-pipeline' of https://github.com/mem0ai/mem0 into feat/v3-pipeline 2026-04-13 13:19:34 -07:00
Soumil RathiandClaude Opus 4.6 7c313add10 fix: update search() return type to match v3 response format
Change TS client search() return type from Promise<Array<Memory>>
to Promise<{ results: Array<Memory> }> to match v3 API envelope.
Update unit test mocks to return {results: []} and fix assertions.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-13 13:19:26 -07:00
chaithanyak42andClaude Opus 4.6 e51df348ce fix(ts-sdk): unwrap v1.1 search response in client, fix TS2339 type errors
search() now unwraps { results: [...] } -> [...] internally (same
pattern getAll() already uses), so callers always get Array<Memory>.

Removes redundant unwrap logic from integration test helpers and
search.test.ts that caused TS2339 'Property results does not exist
on type never' — the false branch of Array.isArray() was unreachable
since search() is typed as returning Array<Memory>.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-14 01:48:22 +05:30
Soumil RathiandClaude Opus 4.6 b9d7ae5fa7 fix: update integration tests for v3 search response format
v3 search returns {results: [...]} instead of a bare array.
Updated waitForSearchResults helper and search edge case tests
to unwrap the v3 envelope.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-13 13:10:17 -07:00
Soumil RathiandClaude Opus 4.6 78cc11ef1f fix: restore lmstudio/deepseek providers in TS factory, add langchain to extras
- Restore LMStudioEmbedder, LMStudioLLM, DeepSeekLLM in TS factory.ts
  (accidentally removed during graph store cleanup — unrelated to graphs)
- Add langchain>=0.1.0 to Python extras dep group (was transitively
  provided by langchain-neo4j in the removed graph group, still needed
  by mem0/llms/langchain.py and mem0/embeddings/langchain.py)
- Add pytest.importorskip("langchain") to test_langchain.py for graceful
  skip when langchain isn't installed

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-13 12:55:36 -07:00
Soumil RathiandClaude Opus 4.6 66446bd118 fix: address reviewer bugs — metadata mutation, test args, embedding dict, output_format
1. Fix _create_procedural_memory metadata mutation: use spread operator
   instead of in-place dict assignment (sync + async)
2. Fix test_add assertion: remove trailing None arg that doesn't match
   _add_to_vector_store(messages, metadata, filters, infer) signature
3. Restore output_format: "v1.1" in TS client search payload as fallback
4. Fix infer=False path: pass {text: embedding} dict to _create_memory
   instead of raw embedding list to avoid redundant embed() calls (sync + async)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-13 11:50:56 -07:00
Soumil RathiandClaude Opus 4.6 163444e33b fix: update TS client tests for v3 API endpoints
Update mock URLs in memoryClient.crud.test.ts and
memoryClient.search.test.ts to match v3 endpoints:
- add: /v1/memories/ -> /v3/memories/
- search: /v2/memories/search/ -> /v3/memories/search/
- deleteAll: stays on /v1/memories/ (no v3 equivalent)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-13 11:34:52 -07:00
Soumil RathiandClaude Opus 4.6 e1e033daef style: run prettier on TS SDK files
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-13 11:29:06 -07:00
Soumil RathiandClaude Opus 4.6 3ae22be8a2 fix: resolve CI failures — lint errors, pytz in redis, lockfile mismatch
- Remove unused imports: get_update_memory_messages, get_fact_retrieval_messages
- Fix pytz.timezone("US/Pacific") → timezone.utc in redis vector store
- Remove unused entity_types variable in test_entity_extraction
- Regenerate pnpm-lock.yaml after neo4j-driver removal

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-13 11:24:14 -07:00
Soumil RathiandClaude Opus 4.6 59880a6f8f feat: TS SDK v3 port, graph store removal, client v3 API migration
TypeScript SDK v3 pipeline (full parity with Python):
- Single-pass additive extraction with ADDITIVE_EXTRACTION_PROMPT
- Hybrid search (semantic + BM25 + entity boost) with additive scoring
- 8-phase batch pipeline (batch embed, persist, entity linking)
- New utils: scoring.ts, lemmatization.ts (natural), entity_extraction.ts (compromise)
- keywordSearch() on 8 vector stores (3 full: PGVector, Memory, Azure AI Search)
- Message persistence in SQLiteManager (rolling window of 10)
- Entity store as second vector collection
- MAX_BATCH=100 chunking guard on OpenAI/Azure embedBatch
- Updated default LLM model to gpt-4.1-nano-2025-04-14
- compromise + natural added as peer dependencies

Graph store removal (Python + TypeScript):
- Removed Neo4j, Memgraph, Kuzu, Neptune, Apache AGE integrations
- Deleted 18 graph-related files across both SDKs
- Removed GraphStoreFactory, GraphStoreConfig, graph_store config field
- Removed "relations" key from all API responses
- Removed graph optional dependency group from pyproject.toml
- Removed neo4j-driver from TS peerDependencies
- Simplified add/search/delete/reset (no more parallel graph operations)

Client SDK v3 API migration:
- add() endpoint: /v1/memories/ -> /v3/memories/ (async response)
- search() endpoint: /v2/memories/search/ -> /v3/memories/search/
- Removed output_format injection and v1.1 unwrapping logic
- Applied to both Python (sync + async) and TypeScript clients

Review feedback fixes:
- Removed deprecated custom_update_memory_prompt from MemoryConfig
- Added MAX_BATCH=100 chunking to Python + TS embed_batch
- Moved all inline imports to top level in main.py
- Cleaned up GraphStoreError dead code from exceptions.py

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-13 10:45:40 -07:00
Soumil Rathi c0343aec1b Merge remote-tracking branch 'origin/feat/v3-pipeline' into feat/v3-pipeline
# Conflicts:
#	mem0-ts/src/oss/src/utils/factory.ts
#	mem0/vector_stores/milvus.py
#	mem0/vector_stores/qdrant.py
2026-04-12 16:30:05 -07:00
9d6b79a14e fix(sdk): removing the enable graph flag and switching from snake case to camel case for client ts sdk (#4776)
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-12 02:40:54 +05:30
KartikandGitHub e44b46ef2e fix(sdk): removing deprecating param from our sdk and docs changes with it (#4740) 2026-04-12 00:34:58 +05:30
Gabriel SteinandGitHub 9d82e2329d refactor(telemetry): sample OSS hot-path events at 10% to reduce PostHog volume (#4771) 2026-04-11 16:25:38 +05:30
398445c691 fix: filters did not support AND, OR and NOT in Qdant and other vector stores (#4780)
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-10 23:43:12 +05:30
e59e3d5f0c Add deepseek.ts to src/llms with corresponding unit tests. Updates fa… (#4613)
Co-authored-by: kartik-mem0 <kartik.labhshetwar@mem0.ai>
2026-04-10 20:06:22 +05:30
KartikandGitHub 6984958138 chore: sat release (#4702) 2026-04-06 16:55:08 +05:30
6cc1c15320 feat(sdk): add multilingual param to project update (#4314)
Co-authored-by: Soumil Rathi <soumilrathi@gmail.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-02 18:38:26 +05:30
Saket AryanandGitHub 5723136bed fix: add repository field to Node packages for npm provenance (#4671) 2026-04-02 16:20:38 +05:30
KartikandGitHub 1bfaaf8750 chore: release (#4657) 2026-04-01 23:44:09 +05:30
Saharsh PatelandGitHub 713dba5d0a fix: replace .single() with .maybeSingle() in SupabaseDB.get() to handle missing rows (#4599) 2026-04-01 18:41:24 +05:30
8ae7a06220 fix: pass dimensions parameter to OpenAI embeddings API (#4632)
Co-authored-by: kartik-mem0 <kartik.labhshetwar@mem0.ai>
2026-04-01 18:40:17 +05:30
47969aaa6b fix(ts): extract JSON from chatty LLM responses in fact retrieval (#4533)
Co-authored-by: kartik-mem0 <kartik.labhshetwar@mem0.ai>
2026-03-30 20:33:11 +05:30
KartikandGitHub b8a5ca1b70 chore: bump mem0ai and mem0-ts versions to 1.0.9/2.4.4 and update changelog (#4585) 2026-03-28 22:42:21 +05:30
431cba20e9 fix(ts): work around Qdrant Cloud "Illegal host" error (#4565)
Co-authored-by: utkarsh240799 <utkarsh240799@users.noreply.github.com>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-authored-by: kartik-mem0 <kartik.labhshetwar@mem0.ai>
2026-03-28 21:50:36 +05:30
e8004b93db chore: updating the sdk version and changelog (#4561)
Co-authored-by: Saket Aryan <saketaryan2002@gmail.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-26 22:21:31 +05:30
Felippe MercurioandGitHub 3a9fcdbec2 fix(oss): make pgvector pg import compatible with ESM (#4544) 2026-03-26 20:07:39 +05:30
HimanshuandGitHub 316dc67a0a fix(ts-oss): register pgvector in VectorStoreFactory (#3367) (#4502) 2026-03-23 18:52:19 +05:30
Aditya PaulandGitHub c39d5ada4d fix: Bug: Zod Schema Incompatible with OpenAI Structured Outputs API (#3462) 2026-03-21 19:48:31 +05:30
06c25eb00b fix: use root LLM config as fallback for graph store instead of hardcoded OpenAI default (#4466)
Co-authored-by: utkarsh240799 <utkarsh240799@users.noreply.github.com>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-21 19:38:49 +05:30
30661ab427 Fix: add pgvector support to NodeJS OSS VectorStoreFactory (fixes #3491) (#3997)
Co-authored-by: kartik-mem0 <kartik.labhshetwar@mem0.ai>
2026-03-20 20:47:04 +05:30
Failfail2603andGitHub 7ad5d6f442 fix: use toCamelCase in redis get method for the payload (#3172) 2026-03-20 20:28:41 +05:30
6663b738d5 refactor: fix webhook create/update serialization, add payload types, and MEMORY_CATEGORIZED event (#4429)
Co-authored-by: Saket Aryan <saketaryan2002@gmail.com>
2026-03-19 22:26:17 +05:30
KartikandGitHub 88abb29de9 fix: handle truncated code blocks in removeCodeBlocks function (#4421) 2026-03-19 18:18:11 +05:30
KartikandGitHub 66e6f58fc6 chore: delete obsolete e2e tests (#4419) 2026-03-19 18:11:32 +05:30
KartikandGitHub 22c2545d61 feat(test): integration test for ts-sdk (#4395) 2026-03-19 18:11:09 +05:30