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
Metadata
Release files for trustrag-langchain 0.1.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 | |
|---|---|---|---|
| trustrag_langchain-0.1.0.tar.gz | 8.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| trustrag_langchain-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 15.2 kB
Release files / trustrag_langchain-0.1.0.tar.gz
| Download URL | trustrag_langchain-0.1.0.tar.gz |
|---|---|
| Size | 8.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5d775b7c332997551c2b9c0eb16339d207e656f4dac1518845cfb0ec6b6c7d23
|
|
BLAKE2b-256 checksum How to use checksums |
05effcab8b2f43be8f69e4ed8c73c37a0e64fe78d97351008dbc9fba54988e9f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Release files / trustrag_langchain-0.1.0-py3-none-any.whl
| Download URL | trustrag_langchain-0.1.0-py3-none-any.whl |
|---|---|
| Size | 7.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
130886b7a549d5d8b34808f5b476e67bf49b0ab0756355607c72a183fca75f73
|
|
BLAKE2b-256 checksum How to use checksums |
6747d2e5713ac3fb0d9036772e88c805faa6430c1cf48313898432ab6908c15e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|