Skip to main content

AI-powered fact-checking Python library

Project description

FactVerfAI

is a Python package that enables robust, automated fact-checking of claims and statements using the latest open-source LLMs and web search APIs. Given any text, FactVerifAI intelligently extracts one or more fact-checkable claims, queries the web for evidence, and generates a markdown fact-checking report with references. The package supports both console and file outputs, parallel processing for faster performance, and detailed debugging for transparency. It is ideal for journalists, researchers, developers, and anyone who wants to automate claim verification in a reproducible, auditable way.


To install the package:

pip install factverifai

How to use

Create new .env example from .env.example and paste EXA API key

import os
from dotenv import load_dotenv
from factverifai import fact_check

load_dotenv()

text = "Nicușor Dan is the president of Romania in 2025, winning against Simion"

fact_check(text, output="files/", max_workers=4, verbose = True, exa=os.getenv("EXA_API_KEY"))

output="console" will print the results; output="files/" will save a markdown file to the specified directory.

max_workers sets parallelism (higher is faster for many claims).

verbose=True enables detailed debug printing.

Setup for developers

  1. Create and install the environment and dependencies. This will:

Go to the folder where factverifai is and run the Makefile:

make

This will:

  • Create a virtual environment named factverifai-env (if it doesn't already exist)
  • Install pip-tools if necessary
  • Compile and install both main and development dependencies
  • Add a Jupyter kernel for the virtual environment (if not already added)
  1. Activate the environment:
source factverifai-env/bin/activate
  1. Configure Ollama

Visit the Ollama website https://ollama.com/download and download the latest version.

Install the version used in this project

ollama pull gemma3:1b
  1. Register for an Exa Api Key

Register on the Exa website and generate an API key.

  1. Configure Secrets Make a copy of the .env.example file and save it as .envinside the factverify folder. Add the EXA_API_KEY key your .env file.

Note: If a new key or variable is added to the .env file, make sure to update the .env.example file as well. This ensures others know what environment variables are needed without exposing actual secrets.

Managing dependencies

In this project, main dependencies are those required for the core functionality of the project and are necessary for both development and production environments. These should be added to requirements.in. On the other hand, development dependencies are only needed during development (e.g., testing tools, linters, and debuggers). These should be added to requirements-dev.in. By keeping them separate, we ensure that production environments remain lean and only contain essential packages, while development environments have everything needed for effective development and testing.

To manage and install dependencies, you can use the provided Makefile. It offers the following targets:

  • make — Installs both main and development dependencies.

  • make requirements — Installs main dependencies from requirements.in.

  • make dev-requirements — Installs development dependencies from requirements-dev.in.

  • For main dependencies (needed for both development and production):

    • If you want to add a library to the main installation, add the package name to requirements.in.
    • Run make requirements to install them.
  • For development dependencies (only needed during development):

    • If you are exploring libraries and want to add them for development purposes, add the library to requirements-dev.in.
    • Run make dev-requirements to install them.
  • To install all dependencies (both main and development):

    • Run make to install everything.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

factverifai-0.1.3.tar.gz (7.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

factverifai-0.1.3-py3-none-any.whl (7.2 kB view details)

Uploaded Python 3

File details

Details for the file factverifai-0.1.3.tar.gz.

File metadata

  • Download URL: factverifai-0.1.3.tar.gz
  • Upload date:
  • Size: 7.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for factverifai-0.1.3.tar.gz
Algorithm Hash digest
SHA256 6336f5d9e992b05d6ee12bb4a52929c68152ec7a0c441e7ea98742c4dea98287
MD5 113adcd2a941f43cc300ce9461764e71
BLAKE2b-256 d2f06dc2ff1cf56c3f8af12260d9351737fd281916e6ec38f3fa0422c2aef319

See more details on using hashes here.

File details

Details for the file factverifai-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: factverifai-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 7.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for factverifai-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 9762258dd605229de6a9a84b9d66dd998dc7064ae892f4d83363e409b1252d84
MD5 dfb54b924f4e705af4ca940a1f4074c5
BLAKE2b-256 5b36c3b8799541f1a5de9b43559dc5ea05425814235bcebfbc14815fb85d1828

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page