Skip to main content

FactGuard Python SDK

PyPI Version License: MIT GitHub Stars

Real-Time Web Intelligence & Multi-LLM Fact-Checking in 3 lines of Python.


⚡ Installation

pip install factguard-ai

🚀 Quickstart

from factguard import FactGuard

# Initialize FactGuard (connects to live cloud or your local server)
fg = FactGuard()

# 1. Fact-check any statement
result = fg.verify("Bananas are naturally radioactive due to potassium-40.")

print(f"Verdict: {result.verdict}")          # 'True'
print(f"Confidence: {result.confidence}")    # 0.95
print(f"Reasoning: {result.reasoning}")      # Evidence analysis
print(f"Sources: {result.evidence_sources}") # ['Wikipedia', ...]
print(f"Citations: {result.evidence_urls}")  # ['https://en.wikipedia.org/...']

🔄 Real-Time SSE Streaming

Stream incremental verification phases live into your terminal, CLI, or UI:

for event in fg.stream("The Eiffel Tower is in Berlin."):
    phase = event.get("phase")
    msg = event.get("message")
    print(f"[{phase}] {msg}")

Turn any verification into a public permalink with dynamic OpenGraph social cards:

result = fg.verify("Water boils at 100 degrees Celsius.")
share_url = fg.share(result)
print(f"Shareable URL: {share_url}")
# Output: https://factguard-1gge.onrender.com/v/a8f2c3

🤖 LangChain & AI Agent Integration

Use FactGuard as an automated ground-truth tool inside LangChain agents:

from langchain.tools import tool
from factguard import FactGuard

fg = FactGuard()

@tool
def fact_check_statement(statement: str) -> str:
    """Verify factual claims using live DuckDuckGo and Wikipedia retrieval."""
    result = fg.verify(statement)
    return f"Verdict: {result.verdict} ({result.confidence*100:.0f}% confidence). Reasoning: {result.reasoning}"

⚙️ Configuration Options

# Connect to your local self-hosted FactGuard instance:
fg = FactGuard(api_url="http://localhost:8000")

# Run with local Ollama or custom model:
fg = FactGuard(
    api_url="http://localhost:8000",
    provider="ollama",
    model="gemma4:e2b"
)

📜 License

MIT License • Created with ❤️ by Santosh Kashyap

Metadata

Release files for factguard-ai 2.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for factguard-ai 2.0.0
File Size Uploaded Provenance Actions
factguard_ai-2.0.0.tar.gz 13.2 kB Without provenance Details for factguard_ai-2.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for factguard-ai 2.0.0
File Interpreter ABI Platform Actions
factguard_ai-2.0.0-py3-none-any.whl Python 3 none any Details for factguard_ai-2.0.0-py3-none-any.whl

Total release size: 21.7 kB

Release files / factguard_ai-2.0.0.tar.gz

Download URL factguard_ai-2.0.0.tar.gz
Size 13.2 kB
Tags Source
SHA-256 checksum
How to use checksums
b88e20cd4dbae4a3a36cfc3bc25337125351eb5eea29ab5b138835425af237a7
BLAKE2b-256 checksum
How to use checksums
d5bfceaf618a314ae1713dc838905c183d1ebb7769a5e8a5ddb965d024ce81b7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.9

Release files / factguard_ai-2.0.0-py3-none-any.whl

Download URL factguard_ai-2.0.0-py3-none-any.whl
Size 8.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f0df3f2fcb8c77a1da89e0e800b27027b7bd4674f5b40b23aac6247b2b261304
BLAKE2b-256 checksum
How to use checksums
e0a01a7336910e1a39e7897902a9d9a424d2987b95cf13a4cd3a89a2f897c621
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.9

Security for factguard-ai 2.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

2.0.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page