An open API service indexing awesome lists of open source software.

https://github.com/datastax/graph-rag

Graph traversal for improved RAG
https://github.com/datastax/graph-rag

genai langchain langchain-python rag retrieval-augmented-generation

Last synced: 5 months ago
JSON representation

Graph traversal for improved RAG

Awesome Lists containing this project

README

          

# Graph RAG

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

[![Status][status-shield]][status-url]
[![Coverage][coverage-shield]][coverage-url]
[![Contributors][contributors-shield]][contributors-url]
[![Forks][forks-shield]][forks-url]
[![Stargazers][stars-shield]][stars-url]
[![Issues][issues-shield]][issues-url]
[![License][license-shield]][license-url]





Logo

Graph RAG - Combining Vector and Graph for better RAG


Library providing Graph RAG combining vector search and traversal of metadata relationships.


Explore the docs » -->




Report Bug
·
Request Feature


Table of Contents


  1. About The Project

  2. Getting Started with LangChain

  3. Roadmap

  4. Contributing

  5. License

## About The Project

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](https://python.langchain.com/docs/introduction/)-specific functionality.

(back to top)

## Getting Started with LangChain

1. Install `langchain-graph-retriever` (or add to your Python dependencies).

```sh
pip install langchain-graph-retriever
```

1. Wrap your existing vector store to enable graph retrieval:

```python
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?")
```

## Roadmap

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](https://github.com/datastax/graph-rag/issues)!

* Support more vector stores
* Support [Lazy Graph RAG](https://www.microsoft.com/en-us/research/blog/lazygraphrag-setting-a-new-standard-for-quality-and-cost/) on the retrieved
documents.

## Contributing

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!

1. Fork the Project
2. Create your Feature Branch (`git checkout -b feature/AmazingFeature`)
3. Commit your Changes (`git commit -m 'Add some AmazingFeature'`)
4. Push to the Branch (`git push origin feature/AmazingFeature`)
5. Open a Pull Request

See [CONTRIBUTING.md](`CONTRIBUTING.md`) for more information on development.

(back to top)


## License

Distributed under the Apache 2 License. See `LICENSE.txt` for more information.

(back to top)

[coverage-shield]: https://img.shields.io/coverallsCoverage/github/datastax/graph-rag?style=for-the-badge
[coverage-url]: https://coveralls.io/github/datastax/graph-rag
[status-shield]: https://img.shields.io/github/check-runs/datastax/graph-rag/main?style=for-the-badge
[status-url]: https://github.com/datastax/graph-rag/actions/workflows/main.yml?query=branch%3Amain
[contributors-shield]: https://img.shields.io/github/contributors/datastax/graph-rag.svg?style=for-the-badge
[contributors-url]: https://github.com/datastax/graph-rag/graphs/contributors
[forks-shield]: https://img.shields.io/github/forks/datastax/graph-rag.svg?style=for-the-badge
[forks-url]: https://github.com/datastax/graph-rag/network/members
[stars-shield]: https://img.shields.io/github/stars/datastax/graph-rag.svg?style=for-the-badge
[stars-url]: https://github.com/datastax/graph-rag/stargazers
[issues-shield]: https://img.shields.io/github/issues/datastax/graph-rag.svg?style=for-the-badge
[issues-url]: https://github.com/datastax/graph-rag/issues
[license-shield]: https://img.shields.io/github/license/datastax/graph-rag.svg?style=for-the-badge
[license-url]: https://github.com/datastax/graph-rag/blob/master/LICENSE.txt