Custom Fact Extraction Prompt
Enhance your product experience by adding custom fact extraction prompt tailored to your needs
Introduction to Custom Fact Extraction Prompt
Custom fact extraction prompt allow you to tailor the behavior of your Mem0 instance to specific use cases or domains. By defining it, you can control how information is extracted from the user’s message.
To create an effective custom fact extraction 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 fact extraction prompt:
Here we initialize the custom fact extraction 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.
The custom fact extraction prompt will process both the user and assistant messages to extract relevant information according to the defined format.