Four bugs that made the profile SDK unusable against the live API, each
found by running the demo notebook end to end rather than by reading.
1. `update_profile_settings()` sent a flat body:
{"enabled": ..., "schema": ..., "custom_instructions": ...}
The API takes only `enabled` and `entities` at the top level and
answers 400 "Unsupported settings: custom_instructions, schema." to
anything else, so every call passing a schema failed.
`get_profile_settings()` already returned the nested shape, so the read
and the write disagreed and the method could not round-trip its own
settings. Both SDKs now nest `schema` and `custom_instructions` under
`entities.<entity_type>` while keeping the flat call signature;
`entity_type` is a new optional argument defaulting to "user".
2. `sample_profiles()` and `regenerate_profiles()` never sent
`entity_type`. Every profile job must name an entity kind, so both
failed with "entity_type must be one of: user, agent."
3. The TypeScript read path rewrote the customer's schema property names.
Once the schema moved under `entities`, `snakeToCamelKeys` camel-cased
the keys inside it, because only a top-level schema was restored
verbatim. A field named `favorite_topics` came back as `favoriteTopics`.
4. `ProfileStatus` declared `notEnabled` and `insufficientData`, but a
status is a value, not a key, so it is never camel-cased. tsc rejected
`status === "insufficient_data"`, which is true at runtime, and accepted
`status === "insufficientData"`, which can never fire. Branching on
status is the documented way to use a profile, so the type steered
every TypeScript caller into a dead branch.
Response-shape corrections found alongside them: sample returns
`entity_ids` on create and a richer `results` array on the job, so the TS
`results` field on the create response is marked deprecated and never set;
regenerate answers 409, not the 501 the docstrings claimed.
Verified against a live environment, from both SDKs: a settings write
followed by a read returns the schema property for property, a partial
update no longer blanks it, sample returns 202 with the entities it
picked, regenerate reaches the server and answers its real
not_yet_available, and a user with no profile returns "insufficient_data".
Adds a user-profiles demo notebook covering the whole loop: schema,
ingestion, generation, a before/after diff of a profile rewriting itself,
schema sampling, and a failure-scenario section for each way the API says
no. It polls the add event to a terminal status instead of sleeping, waits
for the extracted memory count to settle rather than trusting the first
page, and reports plainly when generation cannot finish instead of
presenting an empty profile as a result. Executed end to end: 0 failing
cells.
- python: 20 passed (tests/test_client_profiles.py)
- typescript: 203 passed (src/client/tests/)
Mem0 - The Memory Layer for Your AI Apps
Mem0 is a self-improving memory layer for LLM applications, enabling personalized AI experiences that save costs and delight users. We offer both cloud and open-source solutions to cater to different needs.
See the complete OSS Docs. See the complete Platform API Reference.
1. Installation
For the open-source version, you can install the Mem0 package using npm:
npm i mem0ai
2. API Key Setup
For the cloud offering, sign in to Mem0 Platform to obtain your API Key.
3. Client Features
Cloud Offering
The cloud version provides a comprehensive set of features, including:
- Memory Operations: Perform CRUD operations on memories.
- Search Capabilities: Search for relevant memories using advanced filters.
- Memory History: Track changes to memories over time.
- Error Handling: Robust error handling for API-related issues.
- Async/Await Support: All methods return promises for easy integration.
Open-Source Offering
The open-source version includes the following top features:
- Memory Management: Add, update, delete, and retrieve memories.
- Vector Store Integration: Supports various vector store providers for efficient memory retrieval.
- LLM Support: Integrates with multiple LLM providers for generating responses.
- Customizable Configuration: Easily configure memory settings and providers.
- SQLite Storage: Use SQLite for memory history management.
4. Memory Operations
Mem0 provides a simple and customizable interface for performing memory operations. You can create long-term and short-term memories, search for relevant memories, and manage memory history.
5. Error Handling
The MemoryClient throws errors for any API-related issues. You can catch and handle these errors effectively.
6. Using with async/await
All methods of the MemoryClient return promises, allowing for seamless integration with async/await syntax.
7. Testing the Client
To test the MemoryClient in a Node.js environment, you can create a simple script to verify the functionality of memory operations.
Getting Help
If you have any questions or need assistance, please reach out to us:
- Email: founders@mem0.ai
- Join our discord community
- GitHub Issues: Report bugs or request features