LangChain Graph Retriever
LangChain Graph Retriever is a Python library that supports traversing a document graph on top of vector-based similarity search. It works seamlessly with LangChain's retriever framework and supports various graph traversal strategies for efficient document discovery.
Features
- Vector Search: Perform similarity searches using vector embeddings.
- Graph Traversal: Apply traversal strategies such as breadth-first (Eager) or Maximal Marginal Relevance (MMR) to explore document relationships.
- Customizable Strategies: Easily extend and configure traversal strategies to meet your specific use case.
- Multiple Adapters: Support for various vector stores, including AstraDB, Cassandra, Chroma, OpenSearch, and in-memory storage.
- Synchronous and Asynchronous Retrieval: Supports both sync and async workflows for flexibility in different applications.
Installation
Install the library via pip:
pip install langchain-graph-retriever
Getting Started
Here is an example of how to use LangChain Graph Retriever:
from langchain_graph_retriever import GraphRetriever
from langchain_core.vectorstores import Chroma
# Initialize the vector store (Chroma in this example)
vector_store = Chroma(embedding_function=your_embedding_function)
# Create the Graph Retriever
retriever = GraphRetriever(
store=vector_store,
# Define edges based on document metadata
edges=[("keywords", "keywords")],
)
# Perform a retrieval
documents = retriever.retrieve("What is the capital of France?")
# Print the results
for doc in documents:
print(doc.page_content)
License
This project is licensed under the Apache 2 License. See the LICENSE file for more details.
Metadata
Release files for langchain-graph-retriever 0.8.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| langchain_graph_retriever-0.8.0.tar.gz | 33.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| langchain_graph_retriever-0.8.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 66.9 kB
Release files / langchain_graph_retriever-0.8.0.tar.gz
| Download URL | langchain_graph_retriever-0.8.0.tar.gz |
|---|---|
| Size | 33.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
cd39b551bc3caf1c4bb83c380eb1d7df4de58a9cb56f700e3cd2b577b280be00
|
|
BLAKE2b-256 checksum How to use checksums |
b5a397c2096e1554f721e1dd62d4867cc4104184e1926684e7961a4373365d48
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.6.12
|
Release files / langchain_graph_retriever-0.8.0-py3-none-any.whl
| Download URL | langchain_graph_retriever-0.8.0-py3-none-any.whl |
|---|---|
| Size | 33.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c359f03e8f8af33e15f24137b4f7a165add613b7eba4eb8cda9878891381fd71
|
|
BLAKE2b-256 checksum How to use checksums |
5cb9347f2bb6d50f7733c7b78b84ce872c3cc4b64bbfa479bc7f367a80b48957
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.6.12
|