Metadata-Version: 2.5
Name: langchain-deepinquiry
Version: 0.1.0
Summary: LangChain retriever and tools for the DeepInquiry verified-facts API: cited, tier-scored, signed facts.
Project-URL: Homepage, https://www.deepinquiry.ai
Project-URL: Documentation, https://www.deepinquiry.ai/docs
Project-URL: API reference, https://www.deepinquiry.ai/openapi.json
Author-email: Bryan Rush <api@deepinquiry.ai>
License: MIT
License-File: LICENSE
Keywords: citations,deepinquiry,facts,langchain,rag,retriever,verification
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Requires-Python: >=3.9
Requires-Dist: langchain-core>=0.3.0
Requires-Dist: requests>=2.31
Description-Content-Type: text/markdown

# langchain-deepinquiry

LangChain integration for [DeepInquiry](https://www.deepinquiry.ai): a library of short factual claims,
each returned with its sources, a verification tier (gold, silver, bronze), a source-difference score and a
signed [CiteSig](https://citesig.org) attestation.

## Install

```bash
pip install langchain-deepinquiry
```

Get a free API key (500 requests a month, no card) at https://www.deepinquiry.ai/signup and set it:

```bash
export DEEPINQUIRY_API_KEY="di_live_..."
```

## Retriever

```python
from langchain_deepinquiry import DeepInquiryRetriever

retriever = DeepInquiryRetriever(k=4)
docs = retriever.invoke("how many hearts does an octopus have")
for d in docs:
    print(d.page_content)
    print(d.metadata["verification_tier"], d.metadata["source"])
```

Each Document carries the fact id, the page to cite (`source`), the verification tier, the score, the
source URLs and the signed attestation (`citesig`).

## Agent tools

```python
from langchain_deepinquiry import DeepInquirySearchTool, DeepInquiryGetFactTool, DeepInquiryRandomFactTool

tools = [DeepInquirySearchTool(), DeepInquiryGetFactTool(), DeepInquiryRandomFactTool()]
```

Pass them to any LangChain or LangGraph agent. Results come back as plain text with the sources and a link to cite.

## Try the API first

There is a live, keyless demo on https://www.deepinquiry.ai/api that shows the exact response.

## Terms

The code in this package is MIT licensed. Facts returned by the API have their own terms: the free tier
requires attribution to DeepInquiry (the links in each result serve for that) and paid plans allow commercial
use. See https://www.deepinquiry.ai/terms and https://www.deepinquiry.ai/data-license.

Published by Machine Accountability Corporation.
