Skip to main content

LangChain retriever for traversing document graphs on top of vector-based similarity search.

Project description

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

langchain_graph_retriever-0.6.2.tar.gz (33.5 kB view details)

Uploaded Source

Built Distribution

langchain_graph_retriever-0.6.2-py3-none-any.whl (34.2 kB view details)

Uploaded Python 3

File details

Details for the file langchain_graph_retriever-0.6.2.tar.gz.

File metadata

File hashes

Hashes for langchain_graph_retriever-0.6.2.tar.gz
Algorithm Hash digest
SHA256 476479c70e79b175881defa2ac56c1f4a28237d9a1f61a82369774943a1b6d3a
MD5 e021fff29d1da82718120a08c8554de1
BLAKE2b-256 dbe75b692a9c45d08834bd072a8d20ae37c3e5d7db42dc49921ee159f5f8bcd8

See more details on using hashes here.

File details

Details for the file langchain_graph_retriever-0.6.2-py3-none-any.whl.

File metadata

File hashes

Hashes for langchain_graph_retriever-0.6.2-py3-none-any.whl
Algorithm Hash digest
SHA256 e84e8ae7bc2ee1ba9740acc6a3d418114c8630adaa5412693d1339d44f2ac868
MD5 d7e071305575a84f2d838693f0c2a183
BLAKE2b-256 6d14decb911f26269f95595982a753f60bf6fc44a84606d3ab2ac8bc19204e8f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page