Adding Business Data
Overview
Requests to add data to the same graph are completed sequentially to ensure the graph is built correctly, and processing may be slow for large datasets. Use batch ingestion when adding large datasets such as backfills or document collections.
In addition to incorporating memory through chat history, Zep offers the capability to add data directly to the graph. Zep supports three distinct data types: message, text, and JSON.
The message type is ideal for adding data in the form of chat messages that are not directly associated with a Zep Thread’s chat history. This encompasses any communication with a designated speaker, such as emails or previous chat logs.
The text type is designed for raw text data without a specific speaker attribution. This category includes content from internal documents, wiki articles, or company handbooks. It’s important to note that Zep does not process text directly from links or files.
The JSON type may be used to add any JSON document to Zep. This may include REST API responses or JSON-formatted business data.
You can add data to a graph by specifying a graph_id, or to a user graph by providing a user_id.
Adding Message Data
Here’s an example demonstrating how to add message data to the graph:
Adding Text Data
Here’s an example demonstrating how to add text data to the graph:
Adding JSON Data
Here’s an example demonstrating how to add JSON data to the graph:
Data Size Limit and Chunking
The graph.add endpoint has a data size limit of 10,000 characters when adding data to the graph. If you need to add a document which is more than 10,000 characters, we recommend chunking the document as well as using Anthropic’s contextualized retrieval technique. We have an example of this here. This example uses Graphiti, but the same patterns apply to Zep as well.
Additionally, we recommend using relatively small chunk sizes, so that Zep is able to capture all of the entities and relationships within a chunk. Using a larger chunk size may result in some entities and relationships not being captured.
Managing Your Data on the Graph
The graph.add method returns the episode that was created in the graph from adding that data. You can use this to maintain a mapping between your data and its corresponding episode in the graph and to delete specific data from the graph using the delete episode method.