LangChain integration for TrustRAG — trust-verified retrieval + LangGraph multi-hop agent with trust budget
Project description
trustrag-langchain
LangChain integration for TrustRAG — trust-verified retrieval with LangGraph multi-hop agent.
Install
pip install trustrag-langchain
Quick Start
As Retriever
from trustrag_langchain import TrustRAGRetriever
retriever = TrustRAGRetriever(
endpoint="http://localhost:8000",
min_trust_score=70,
)
docs = retriever.invoke("What's the fall protection height?")
for doc in docs:
print(f"Trust: {doc.metadata['trust_score']}")
print(doc.page_content)
As Multi-Hop Agent
from trustrag_langchain import TrustRAGRetriever, TrustBudgetAgent
from langchain_groq import ChatGroq
agent = TrustBudgetAgent(
retriever=TrustRAGRetriever(endpoint="http://localhost:8000"),
llm=ChatGroq(model="llama-3.3-70b-versatile"),
min_trust_threshold=150,
max_retrievals=3,
)
result = await agent.ainvoke("What PPE is required for work at heights above 6ft?")
print(f"Outcome: {result['outcome']}") # "answer" or "stop_low_trust"
print(f"Cumulative trust: {result['cumulative_trust']}")
print(result["answer"])
Why TrustRAG + LangChain?
- Trust filtering: Answers below threshold never enter your agent's context
- Budget-aware agents: Multi-hop reasoning stops early when evidence is insufficient
- Citation chain: Every claim traceable to source documents with trust scores
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file trustrag_langchain-0.1.0.tar.gz.
File metadata
- Download URL: trustrag_langchain-0.1.0.tar.gz
- Upload date:
- Size: 8.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5d775b7c332997551c2b9c0eb16339d207e656f4dac1518845cfb0ec6b6c7d23
|
|
| MD5 |
ecf15f8f9e1a8f3ca47c05fbc16d8e89
|
|
| BLAKE2b-256 |
05effcab8b2f43be8f69e4ed8c73c37a0e64fe78d97351008dbc9fba54988e9f
|
File details
Details for the file trustrag_langchain-0.1.0-py3-none-any.whl.
File metadata
- Download URL: trustrag_langchain-0.1.0-py3-none-any.whl
- Upload date:
- Size: 7.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
130886b7a549d5d8b34808f5b476e67bf49b0ab0756355607c72a183fca75f73
|
|
| MD5 |
080d2c14d41d3f2218269565c3e00f92
|
|
| BLAKE2b-256 |
6747d2e5713ac3fb0d9036772e88c805faa6430c1cf48313898432ab6908c15e
|