Metadata-Version: 2.4
Name: trustrag-langchain
Version: 0.1.0
Summary: LangChain integration for TrustRAG — trust-verified retrieval + LangGraph multi-hop agent with trust budget
Project-URL: Homepage, https://github.com/jigangz/TrustRAG
Project-URL: Repository, https://github.com/jigangz/TrustRAG
Project-URL: Issues, https://github.com/jigangz/TrustRAG/issues
Author-email: Jigang Zhou <zjg0907008@gmail.com>
License: MIT
License-File: LICENSE
Keywords: langchain,langgraph,rag,retrieval,trust
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3.11
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Requires-Python: >=3.11
Requires-Dist: httpx>=0.27
Requires-Dist: langchain-core<2.0,>=0.3
Requires-Dist: langgraph<2.0,>=0.2
Requires-Dist: pydantic>=2
Provides-Extra: dev
Requires-Dist: pytest; extra == 'dev'
Requires-Dist: pytest-asyncio; extra == 'dev'
Requires-Dist: respx; extra == 'dev'
Description-Content-Type: text/markdown

# trustrag-langchain

LangChain integration for TrustRAG — trust-verified retrieval with LangGraph multi-hop agent.

## Install

```bash
pip install trustrag-langchain
```

## Quick Start

### As Retriever

```python
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

```python
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
