Skip to main content

Loki: An Open-source Tool for Fact Verification

Overview

Loki is our open-source solution designed to automate the process of verifying factuality. It provides a comprehensive pipeline for dissecting long texts into individual claims, assessing their worthiness for verification, generating queries for evidence search, crawling for evidence, and ultimately verifying the claims. This tool is especially useful for journalists, researchers, and anyone interested in the factuality of information. To stay updated, please subscribe to our newsletter at our website or join us on Discord!

Quick Start

Clone the repository and navigate to the project directory

git clone https://github.com/Libr-AI/OpenFactVerification.git
cd OpenFactVerification

Installation with poetry (option 1)

  1. Install Poetry by following it installation guideline.
  2. Install all dependencies by running:
poetry install

Installation with pip (option 2)

  1. Create a Python environment at version 3.9 or newer and activate it.

  2. Navigate to the project directory and install the required packages:

pip install -r requirements.txt

Configure API keys

You can choose to export essential api key to the environment

  • Example: Export essential api key to the environment
export SERPER_API_KEY=... # this is required in evidence retrieval if serper being used
export OPENAI_API_KEY=... # this is required in all tasks

Alternatively, you configure API keys via a YAML file, see user guide for more details.

A sample test case:

Usage

The main interface of Loki fact-checker located in factcheck/__init__.py, which contains the check_response method. This method integrates the complete fact verification pipeline, where each functionality is encapsulated in its class as described in the Features section.

Used as a Library

from factcheck import FactCheck

factcheck_instance = FactCheck()

# Example text
text = "Your text here"

# Run the fact-check pipeline
results = factcheck_instance.check_response(text)
print(results)

Used as a Web App

python webapp.py --api_config demo_data/api_config.yaml

Multimodal Usage

# String
python -m factcheck --modal string --input "MBZUAI is the first AI university in the world"
# Text
python -m factcheck --modal text --input demo_data/text.txt
# Speech
python -m factcheck --modal speech --input demo_data/speech.mp3
# Image
python -m factcheck --modal image --input demo_data/image.webp
# Video
python -m factcheck --modal video --input demo_data/video.m4v

Customize Your Experience

For advanced usage, please see our user guide.

Ready for More?

💪 Join Our Journey to Innovation with the Supporter Edition

As we continue to evolve and enhance our fact-checking solution, we're excited to invite you to become an integral part of our journey. By registering for our Supporter Edition, you're not just unlocking a suite of advanced features and benefits; you're also fueling the future of trustworthy information.

Your support enables us to:

🚀 Innovate continuously: Develop new, cutting-edge features that keep you ahead in the fight against misinformation.

💡 Improve and refine: Enhance the user experience, making our app not just powerful, but also a joy to use.

🌱 Grow our community: Invest in the resources and tools our community needs to thrive and expand.

🎁 And as a token of our gratitude, registering now grants you complimentary token credits—a little thank you from us to you, for believing in our mission and supporting our growth!

Feature Open-Source Edition Supporter Edition
Trustworthy Verification Results ✅ ✅
Diverse Evidence from the Open Web ✅ ✅
Automated Correction of Misinformation ✅ ✅
Privacy and Data Security ✅ ✅
Multimodal Input ✅ ✅
One-Stop Custom Solution ❌ ✅
Customizable Verification Data Sources ❌ ✅
Enhanced User Experience ❌ ✅
Faster Efficiency and Higher Accuracy ❌ ✅

TRY NOW!

Contributing to Loki project

Welcome and thank you for your interest in the Loki project! We welcome contributions and feedback from the community. To get started, please refer to our Contribution Guidelines.

Acknowledgments

  • Special thanks to all contributors who have helped in shaping this project.

Stay Connected and Informed

Don’t miss out on the latest updates, feature releases, and community insights! We invite you to subscribe to our newsletter and become a part of our growing community.

💌 Subscribe now at our website!

Star History

Star History Chart

Cite as

@misc{Loki,
  author       = {Wang, Hao and Wang, Yuxia and Wang, Minghan and Geng, Yilin and Zhao, Zhen and Zhai, Zenan and Nakov, Preslav and Baldwin, Timothy and Han, Xudong and Li, Haonan},
  title        = {Loki: An Open-source Tool for Fact Verification},
  month        = {04},
  year         = {2024},
  publisher    = {Zenodo},
  version      = {v0.0.2},
  doi          = {10.5281/zenodo.11004461},
  url          = {https://zenodo.org/records/11004461}

Metadata

Release files for openfactverification-kongzii 0.6.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 openfactverification-kongzii 0.6.0
File Size Uploaded Provenance Actions
openfactverification_kongzii-0.6.0.tar.gz 28.5 kB Without provenance Details for openfactverification_kongzii-0.6.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for openfactverification-kongzii 0.6.0
File Interpreter ABI Platform Actions
openfactverification_kongzii-0.6.0-py3-none-any.whl Python 3 none any Details for openfactverification_kongzii-0.6.0-py3-none-any.whl

Total release size: 66.3 kB

Release files / openfactverification_kongzii-0.6.0.tar.gz

Download URL openfactverification_kongzii-0.6.0.tar.gz
Size 28.5 kB
Tags Source
SHA-256 checksum
How to use checksums
3d2f2b29d38e78acd388a4609d706fa40be842400ae97a8ea86819636922255f
BLAKE2b-256 checksum
How to use checksums
e5c4c504acbc6508bf3f7e38165cde27d52f2407287e26e3150c311281a965d8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.6.1 CPython/3.8.14 Darwin/25.3.0

Release files / openfactverification_kongzii-0.6.0-py3-none-any.whl

Download URL openfactverification_kongzii-0.6.0-py3-none-any.whl
Size 37.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
165350b8efef8b04ad4d86316e7fe1709cfff2d48e94e19efdb570643abbe83a
BLAKE2b-256 checksum
How to use checksums
e39caa932b281a5cb270de1078e6be2104679ce79fb4a14bfab3b57a6f3cfcf3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.6.1 CPython/3.8.14 Darwin/25.3.0

Security for openfactverification-kongzii 0.6.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.

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