LangChain tool for data validation and fact-checking. Helps AI agents avoid hallucinations.
Project description
LangChain Data Validator Tool
A LangChain tool that validates data, checks facts, and detects logical errors using an external AI agent. Perfect for hallucination prevention in LLM applications.
Features
- ✅ Fact-checking across multiple domains
- ✅ Logical error detection
- ✅ Misinformation identification
- ✅ $0.10 per request (premium reasoning layer)
- ✅ Async and sync support
- ✅ Easy integration with LangChain agents
Installation
pip install langchain-data-validator
## Quick Start
from langchain.agents import AgentExecutor, create_tool_calling_agent
from langchain_openai import ChatOpenAI
from langchain import hub
from langchain_data_validator import DataValidatorTool
# Create tool
validator_tool = DataValidatorTool()
# Setup agent
tools = [validator_tool]
llm = ChatOpenAI(model="gpt-3.5-turbo")
prompt = hub.pull("hwchase17/openai-tools-agent")
agent = create_tool_calling_agent(llm, tools, prompt)
agent_executor = AgentExecutor(agent=agent, tools=tools, verbose=True)
# Use it
result = agent_executor.invoke({
"input": "Check if 'Bitcoin price is $100,000' is correct"
})
print(result)
## Direct Usage
from langchain_data_validator import DataValidatorTool
tool = DataValidatorTool()
result = tool.run("Water boils at 50°C")
print(result) # "Result: WRONG: Water boils at 100°C at sea level. (Cost: $0.10)"
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 langchain_data_validator-0.1.0.tar.gz.
File metadata
- Download URL: langchain_data_validator-0.1.0.tar.gz
- Upload date:
- Size: 4.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b6d1530ab7bc87a26484730dafa4032d210e688c6abe93ad567ad11f49b80b57
|
|
| MD5 |
97b4b044960d26b7e3020cdea63be4e8
|
|
| BLAKE2b-256 |
f4a50aab866292eb43f0a4639e5daf0a30bc1c9c302bfa8fcde7d8758de7278d
|
File details
Details for the file langchain_data_validator-0.1.0-py3-none-any.whl.
File metadata
- Download URL: langchain_data_validator-0.1.0-py3-none-any.whl
- Upload date:
- Size: 3.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bff90a490720098cd64b9b97e734ae445d32c2fd9e8750b09ec76b78ed7e1a7b
|
|
| MD5 |
2a1e3e031ea0ea626bede54447416b46
|
|
| BLAKE2b-256 |
5ac760c3b3cb8f1a8695d41903ca2cecc8aa497808699e820f4382cb5887f347
|