diff --git a/docs/changelog/sdk.mdx b/docs/changelog/sdk.mdx index 5598d0d96..14c9c014d 100644 --- a/docs/changelog/sdk.mdx +++ b/docs/changelog/sdk.mdx @@ -7,6 +7,18 @@ mode: "wide" + + +**Bug Fixes:** +- **Core:** `add()` (`Memory` and `AsyncMemory`) no longer reports records the vector store rejected as successful `ADD` events. Only records that were actually inserted are written to history, entity-linked, and returned. If none of the extracted memories could be inserted, `add()` now raises `VectorStoreError` instead of returning memories that were never stored ([#7066](https://github.com/mem0ai/mem0/pull/7066)) +- **Core:** Restore the context-manager protocol on `Memory` (`with Memory() as m:`) and `AsyncMemory` (`async with AsyncMemory() as m:`), which closes the instance on exit ([#7354](https://github.com/mem0ai/mem0/pull/7354)) +- **LLMs:** The AWS Bedrock Anthropic path now returns the first Converse content block that carries text instead of always reading `content[0]`. Claude reasoning models can emit a `reasoningContent` block before the text block, which previously made the call fail with a `KeyError` ([#6369](https://github.com/mem0ai/mem0/pull/6369)) +- **Vector Stores:** Turbopuffer filters now apply every operator (`eq`, `ne`, `gt`, `gte`, `lt`, `lte`, `in`, `nin`). Only `gte` and `lte` were read before, so any other operator was silently dropped and the query returned unfiltered results. An unsupported operator now raises `ValueError` ([#6564](https://github.com/mem0ai/mem0/pull/6564)) +- **Vector Stores:** Turbopuffer `search()` scores now respect `distance_metric`. With `euclidean_squared`, the unbounded squared distance maps to `1 / (1 + distance)` instead of `1 - distance`, which went negative and inverted ranking for any distance above 1 ([#6559](https://github.com/mem0ai/mem0/pull/6559)) +- **Vector Stores:** S3 Vectors `search()` scores are now metric-aware. With `euclidean`, the distance maps to `1 / (1 + distance)` instead of `max(0, 1 - distance)`, which collapsed most scores to 0 ([#6547](https://github.com/mem0ai/mem0/pull/6547)) + + + **New Features:** @@ -1245,6 +1257,16 @@ See the [OSS v2 to v3 migration guide](https://docs.mem0.ai/migration/oss-v2-to- + + +**Bug Fixes:** +- **Config (OSS):** `ConfigManager` no longer injects OpenAI's default `baseURL` and `model` into non-OpenAI LLM providers. The defaults now apply only to `openai` and `openai_structured`, so a DeepSeek, xAI, or other provider config without an explicit `baseURL` or `model` falls back to that provider's own defaults and env vars (`DEEPSEEK_API_BASE`, `XAI_API_BASE`, ...) instead of pointing at OpenAI with an OpenAI model name ([#7350](https://github.com/mem0ai/mem0/pull/7350)) +- **Vector Stores:** Turbopuffer filters now apply every operator (`eq`, `ne`, `gt`, `gte`, `lt`, `lte`, `in`, `nin`). Only the range operators were read before, so `eq`, `ne`, `in`, and `nin` were silently dropped. A `"*"` value now matches anything instead of nothing, an array value is treated as `in`, and an unsupported operator throws ([#6578](https://github.com/mem0ai/mem0/pull/6578)) +- **Vector Stores:** Turbopuffer `search()` with `euclidean_squared` now maps the unbounded squared distance to `1 / (1 + distance)` instead of `1 - distance`, which went negative and inverted ranking for any distance above 1 ([#6580](https://github.com/mem0ai/mem0/pull/6580)) +- **Packaging:** `pg`, `@types/pg`, and `natural` are now optional peer dependencies, and `pg` / `@types/pg` accept caret ranges instead of the exact `8.11.3` / `8.11.0` pins, so installing `mem0ai` no longer pulls in `pg` or conflicts with an app's own `pg` version. The PGVector store now imports `pg` only when it is used, so install it alongside `mem0ai` (`npm install pg`) if you use that store. `@types/jest` moved from peer dependencies to dev dependencies ([#7450](https://github.com/mem0ai/mem0/pull/7450)) + + + **New Features:** diff --git a/mem0-ts/package.json b/mem0-ts/package.json index e6f29d4cb..b03a73485 100644 --- a/mem0-ts/package.json +++ b/mem0-ts/package.json @@ -1,6 +1,6 @@ { "name": "mem0ai", - "version": "3.3.0", + "version": "3.3.1", "description": "The Memory Layer For Your AI Apps", "main": "./dist/index.js", "module": "./dist/index.mjs", diff --git a/mem0-ts/src/oss/tests/turbopuffer.score.test.ts b/mem0-ts/src/oss/tests/turbopuffer.score.test.ts index b6e8ba844..31db83ce3 100644 --- a/mem0-ts/src/oss/tests/turbopuffer.score.test.ts +++ b/mem0-ts/src/oss/tests/turbopuffer.score.test.ts @@ -2,24 +2,20 @@ /** * Turbopuffer vector store — score conversion unit tests. * - * Drives parseRows() through the public search() API with a virtually-mocked + * Drives parseRows() through the public search() API with a mocked * @turbopuffer/turbopuffer peer, asserting the score returned per metric. */ const mockQuery = jest.fn(); -jest.mock( - "@turbopuffer/turbopuffer", - () => ({ - __esModule: true, - default: class { - namespace() { - return { query: mockQuery }; - } - }, - }), - { virtual: true }, -); +jest.mock("@turbopuffer/turbopuffer", () => ({ + __esModule: true, + default: class { + namespace() { + return { query: mockQuery }; + } + }, +})); import { TurbopufferDB } from "../src/vector_stores/turbopuffer"; diff --git a/mem0-ts/src/oss/tests/turbopuffer.unit.test.ts b/mem0-ts/src/oss/tests/turbopuffer.unit.test.ts index 5dcec9f05..c781f3ebb 100644 --- a/mem0-ts/src/oss/tests/turbopuffer.unit.test.ts +++ b/mem0-ts/src/oss/tests/turbopuffer.unit.test.ts @@ -3,27 +3,22 @@ * Turbopuffer vector store — filter translation unit tests. * * Drives the private convertFilters() through the public search() API with a - * virtually-mocked @turbopuffer/turbopuffer peer, and asserts the filter tuple - * handed to ns.query(). + * mocked @turbopuffer/turbopuffer peer, and asserts the filter tuple handed to + * ns.query(). */ const mockQuery = jest.fn().mockResolvedValue({ rows: [] }); -// The peer is an optional dependency and may not be installed; mock it -// virtually. createClient() does `new sdk.default({...})`, whose namespace() -// returns the object search() calls query() on. -jest.mock( - "@turbopuffer/turbopuffer", - () => ({ - __esModule: true, - default: class { - namespace() { - return { query: mockQuery }; - } - }, - }), - { virtual: true }, -); +// createClient() does `new sdk.default({...})`, whose namespace() returns the +// object search() calls query() on. +jest.mock("@turbopuffer/turbopuffer", () => ({ + __esModule: true, + default: class { + namespace() { + return { query: mockQuery }; + } + }, +})); import { TurbopufferDB } from "../src/vector_stores/turbopuffer"; diff --git a/pyproject.toml b/pyproject.toml index b16a6c0db..c6c1f38d3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "hatchling.build" [project] name = "mem0ai" -version = "2.2.0" +version = "2.2.1" description = "Long-term memory for AI Agents" authors = [ { name = "Mem0", email = "support@mem0.ai" }