Custom Prompts
Enhance your product experience by adding custom prompts tailored to your needs
Introduction to Custom Prompts
Custom prompts allow you to tailor the behavior of your Mem0 instance to specific use cases or domains. By defining a custom prompt, you can control how information is extracted, processed, and stored in your memory system.
To create an effective custom prompt:
- Be specific about the information to extract.
- Provide few-shot examples to guide the LLM.
- Ensure examples follow the format shown below.
Example of a custom prompt:
Here we initialize the custom prompt in the config.
Example 1
In this example, we are adding a memory of a user ordering a laptop. As seen in the output, the custom prompt is used to extract the relevant information from the user’s message.
Example 2
In this example, we are adding a memory of a user liking to go on hikes. This add message is not specific to the use-case mentioned in the custom prompt. Hence, the memory is not added.