Retrievers providing both unstructured (similarity-search on vectors) and structured (traversal of metadata properties).

Library providing Graph RAG combining vector search and traversal of metadata relationships.
Explore the docs » -->
Report Bug
·
Request Feature
Table of Contents
Graph RAG provides retrievers combining vector-search (for unstructured similarity) and traversal (for structured relationships in metadata). These retrievers are implemented using the metadata search functionality of existing vector stores, allowing you to traverse your existing vector store!
The core library (graph-retriever
) supports can be used in generic Python applications, while langchain-graph-retriever
provides langchain-specific functionality.
-
Install
langchain-graph-retriever
(or add to your Python dependencies).pip install langchain-graph-retriever
-
Wrap your existing vector store to enable graph retrieval:
from langchain_graph_retriever import GraphRetriever retriever = GraphRetriever( # Adapt AstraDBVectorStore for use with Graph Retrievers. # Exposes functionality of the underlying store that is otherwise not available. store = store, # Define the relationships to navigate: # 1. From nodes with a list of `mentions` to the nodes with the corresponding `ids`. # 2. From nodes with a list of related `entities` to other nodes with the same entities. edges = [("mentions", "id"), "entities"], ) retriever.invoke("where is Santa Clara?")
Graph RAG is under active development. This is an overview of our current roadmap - please 👍 issues that are important to you. Don't see a feature that would be helpful for your application - create a feature request!
- Support more vector stores
- Support Lazy Graph RAG on the retrieved documents.
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
See CONTRIBUTING.md for more information on development.
Distributed under the Apache 2 License. See LICENSE.txt
for more information.