Skip to content

Commit edc92ba

Browse files
committed
docs(mem0): point pgvector rank-fix at upstream PR #4994
Opened the Python equivalent of the merged TS fix (#4944) at mem0ai/mem0#4994 — update both the README patches table and the deployment.yaml comment so the stopgap can be dropped without re-research once #4994 merges and we bump the image.
1 parent 5bfbbd2 commit edc92ba

2 files changed

Lines changed: 4 additions & 5 deletions

File tree

apps/mem0/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ single `sed` patch before launching uvicorn. The patches are visible in
112112

113113
| # | Patch | Reason | Drop when |
114114
|---|-------|--------|-----------|
115-
| 1 | `pgvector.py` line 251: `score=float(r[1])``score=float(1.0 - r[1])` | mem0 v2.0.1's pgvector backend returns cosine **distance** as the `score` field, but `score_and_rank` (used by `/search`) treats `score` as similarity and sorts `reverse=True`. Without this fix, the LEAST-similar memories rank first — exact-text matches end up dead last. The TS SDK was fixed in upstream PR [#4944](https://github.com/mem0ai/mem0/pull/4944); the Python equivalent is not yet upstream. | A new image tag containing the Python equivalent of #4944 lands. Then drop `command:` + `args:` from `deployment.yaml`, restoring the image's default CMD. |
115+
| 1 | `pgvector.py` line 251: `score=float(r[1])``score=float(1.0 - r[1])` | mem0 v2.0.1's pgvector backend returns cosine **distance** as the `score` field, but `score_and_rank` (used by `/search`) treats `score` as similarity and sorts `reverse=True`. Without this fix, the LEAST-similar memories rank first — exact-text matches end up dead last. The TS SDK was fixed in upstream PR [#4944](https://github.com/mem0ai/mem0/pull/4944); the Python equivalent is open as [#4994](https://github.com/mem0ai/mem0/pull/4994). | A new image tag containing #4994 lands. Then drop `command:` + `args:` from `deployment.yaml`, restoring the image's default CMD. |
116116

117117
The container fails fast (`grep -q ... || exit 1`) if a future image bump
118118
silently breaks the patch (e.g., upstream rewrites the line) — better than

apps/mem0/deployment.yaml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,9 @@ spec:
5656
# but score_and_rank() treats `score` as similarity (sorts
5757
# reverse=True), so the LEAST-similar memories rank first. Convert
5858
# distance→similarity (`1.0 - r[1]`). Same fix the TypeScript SDK
59-
# already received in upstream PR #4944; the Python equivalent is
60-
# not yet upstream. Drop this command override + restore the
61-
# image's default CMD once the Python fix lands and we bump the
62-
# image tag.
59+
# already received in upstream PR #4944; Python equivalent is
60+
# open as PR #4994. Drop this command override + restore the
61+
# image's default CMD once #4994 lands and we bump the image tag.
6362
# The sed range `/ORDER BY distance/,/return \[OutputData/` scopes
6463
# the substitution to search() only, leaving keyword_search()'s
6564
# ts_rank score (already-similarity) untouched. The grep gate

0 commit comments

Comments
 (0)