Skip to content

Graph RAG

Graph RAG provides retrievers that combine unstructured similarity-search on vectors and structured traversal of metadata properties. These retrievers are implemented using the metadata search functionality of existing vector stores, allowing you to traverse your existing vector store!

  • Link based on existing metadata


    Use existing metadata fields without additional processing. Retrieve more from your existing vector store!

    Get started

  • Change links on demand


    Edges can be specified on-the-fly, allowing different relationships to be traversed based on the question.

    Edges

  • Pluggable Traversal Strategies


    Use built-in traversal strategies like Eager or MMR, or define your own logic to select which nodes to explore.

    Strategies

  • Broad compatibility


    Adapters are available for a variety of vector stores with support for additional stores easily added.

    Adapters

Example: LangChain Retriever combining Vector and Graph traversal

from langchain_graph_retriever import GraphRetriever
from graph_retriever.edges import Id

retriever = GraphRetriever(
    store = store,
    edges = [("mentions", Id()), ("entities", "entities")], # (1)!
)

retriever.invoke("where is Santa Clara?")
  1. edges configures traversing from a node to other nodes listed in the metadata["mentions"] field (to the corresponding id) and to other nodes with overlapping metadata["entities"].

See Examples for more complete examples.