Find Facts Relevant to a Specific Node
Below, we will go through how to retrieve facts which are related to a specific node in a Zep knowledge graph. First, we will go through some methods for determining the UUID of the node you are interested in. Then, we will go through some methods for retrieving the facts related to that node.
If you are interested in the user’s node specifically, we have a convenience method that returns the user’s node which includes the UUID.
An easy way to determine the UUID for other nodes is to use the graph explorer in the Zep Web app.
You can also programmatically retrieve all the nodes for a given user using our get nodes by user API, and then manually examine the nodes and take note of the UUID of the node of interest:
Lastly, if your user has a lot of nodes to look through, you can narrow down the search by only looking at the nodes relevant to a specific query, using our graph search API:
Use the get edges by user API with the connected_node_uuids filter to retrieve only the facts connected to your chosen node. The server applies the filter, so you don’t fetch and discard every other edge in the graph:
Fetching every edge in the graph and filtering by source_node_uuid/target_node_uuid client-side works but scales poorly. Prefer the connected_node_uuids filter for any graph beyond toy size.
You can also retrieve facts relevant to your node by using the graph search API with the node distance re-ranker:
In this recipe, we went through how to retrieve facts which are related to a specific node in a Zep knowledge graph. We first went through some methods for determining the UUID of the node you are interested in. Then, we went through some methods for retrieving the facts related to that node.