Update README.md
Browse files
README.md
CHANGED
|
@@ -7,4 +7,41 @@ sdk: static
|
|
| 7 |
pinned: false
|
| 8 |
---
|
| 9 |
|
| 10 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
pinned: false
|
| 8 |
---
|
| 9 |
|
| 10 |
+
# Graph RAG
|
| 11 |
+
|
| 12 |
+
Retrievers providing both **unstructured** (similarity-search on vectors) and
|
| 13 |
+
**structured** (traversal of metadata properties).
|
| 14 |
+
|
| 15 |
+
## About The Project
|
| 16 |
+
|
| 17 |
+
Graph RAG provides retrievers combining vector-search (for unstructured similarity) and traversal (for structured relationships in metadata).
|
| 18 |
+
These retrievers are implemented using the metadata search functionality of existing vector stores, **allowing you to traverse your existing vector store**!
|
| 19 |
+
|
| 20 |
+
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.
|
| 21 |
+
|
| 22 |
+
<!-- GETTING STARTED -->
|
| 23 |
+
## Getting Started with LangChain
|
| 24 |
+
|
| 25 |
+
1. Install `langchain-graph-retriever` (or add to your Python dependencies).
|
| 26 |
+
|
| 27 |
+
```sh
|
| 28 |
+
pip install langchain-graph-retriever
|
| 29 |
+
```
|
| 30 |
+
|
| 31 |
+
1. Wrap your existing vector store to enable graph retrieval:
|
| 32 |
+
|
| 33 |
+
```python
|
| 34 |
+
from langchain_graph_retriever import GraphRetriever
|
| 35 |
+
|
| 36 |
+
retriever = GraphRetriever(
|
| 37 |
+
# Adapt AstraDBVectorStore for use with Graph Retrievers.
|
| 38 |
+
# Exposes functionality of the underlying store that is otherwise not available.
|
| 39 |
+
store = store,
|
| 40 |
+
# Define the relationships to navigate:
|
| 41 |
+
# 1. From nodes with a list of `mentions` to the nodes with the corresponding `ids`.
|
| 42 |
+
# 2. From nodes with a list of related `entities` to other nodes with the same entities.
|
| 43 |
+
edges = [("mentions", "id"), "entities"],
|
| 44 |
+
)
|
| 45 |
+
|
| 46 |
+
retriever.invoke("where is Santa Clara?")
|
| 47 |
+
```
|