A fact is stored on an edge and captures a detailed relationship about specific events. It includes valid_at and invalid_at timestamps, ensuring temporal accuracy and preserving a clear history of changes over time. This makes facts reliable sources of truth for critical information retrieval, providing the authoritative context needed for accurate decision-making and analysis by your agent.
A summary resides on a node and provides a broad snapshot of an entity or concept and its relationships to other nodes. Summaries offer an aggregated and concise representation, making it easier to understand key information at a glance.
Zep does not recommend relying solely on summaries for grounding LLM responses. While summaries provide a high-level overview, the Context Block should be used since it includes relevant facts (each with valid and invalid timestamps). This ensures that conversations are based on up-to-date and contextually accurate information.
When calling Get Session Memory, Zep employs a sophisticated search strategy to surface the most pertinent information. The system first examines recent context by analyzing the last 4 messages (2 complete chat turns). It then utilizes multiple search techniques, with reranking steps to identify and prioritize the most contextually significant details for the current conversation.
The returned, context is structured as a string, optimized for language model prompts, making it easy to integrate into AI workflows. For more details, see Key Concepts. In addition to the context, the API response includes an array of the identified relevant_facts with their supporting details.
Not all relevant_facts are equally important to your specific use-case. For example, a relationship coach app may need to recall important facts about a user’s family, but what the user ate for breakfast Friday last week is unimportant.
Fact ratings are a way to help Zep understand the importance of relevant_facts to your particular use case. After implementing fact ratings, you can specify a minRating when retrieving relevant_facts from Zep, ensuring that the memory context string contains customized content.
The fact_rating_instruction framework consists of an instruction and three example facts, one for each of a high, medium, and low rating. These are passed when Adding a User or Adding a Group and become a property of the User or Group.
All facts are rated on a scale between 0 and 1. You can access rating when retrieving relevant_facts from Get Session Memory.
You can filter relevant_facts by setting the minRating parameter in Get Session Memory.
Facts and summaries are generated as part of the ingestion process. If you follow the directions for adding data to the graph, new facts and summaries will be created.
Deleting facts and summaries is handled by deleting data from the graph. Facts and summaries will be deleted when you delete the edge or node they exist on.
You can extract facts and summaries using the following methods: