base on Loki: Open-source solution designed to automate the process of verifying factuality <div align="center"> <br /> <a href="https://www.librai.tech"> <img alt="LibrAI Logo" src="./assets/librai_librai.png" alt="LibrAI Logo" width="50%" height="auto"> </a> <br /> </div> # 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](https://www.librai.tech/) or join us on [Discord](https://discord.gg/ssxtFVbDdT)! ## Quick Start ### Clone the repository and navigate to the project directory ```bash git clone https://github.com/Libr-AI/OpenFactVerification.git cd OpenFactVerification ``` ### Installation with poetry (option 1) 1. Install Poetry by following it [installation guideline](https://python-poetry.org/docs/). 2. Install all dependencies by running: ```bash 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: ```bash 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 ```bash 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](docs/user_guide.md) for more details. A sample test case: <div align="center"> <img src="./assets/cmd_example.gif" alt="drawing" width="80%"/> </div> ## 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 ```python 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 ```bash python webapp.py --api_config demo_data/api_config.yaml ``` #### Multimodal Usage ```bash # 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](docs/user_guide.md). ## [Try Our Online Service](https://aip.librai.tech/login) <!-- πŸ’ͺ **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. Below is a screenshot of our online service. [Click here to try it now!](https://aip.librai.tech/login) <div align="center"> <img src="./assets/online_screenshot.png" alt="drawing" width="80%"/> </div> <!-- 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! <div align="center"> | 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 | ❌ | βœ… | </div> --> ## 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](https://github.com/Libr-AI/OpenFactVerification/tree/main/docs/CONTRIBUTING.md). ### Acknowledgments - Special thanks to all contributors who have helped in shaping this project. <!--- add slack channel here --> ### 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](https://www.librai.tech/)! ## Star History > [![Star History Chart](https://api.star-history.com/svg?repos=Libr-AI/OpenFactVerification&type=Date)](https://star-history.com/#Libr-AI/OpenFactVerification&Date) ## Cite as ``` @misc{li2024lokiopensourcetoolfact, title={Loki: An Open-Source Tool for Fact Verification}, author={Haonan Li and Xudong Han and Hao Wang and Yuxia Wang and Minghan Wang and Rui Xing and Yilin Geng and Zenan Zhai and Preslav Nakov and Timothy Baldwin}, year={2024}, eprint={2410.01794}, archivePrefix={arXiv}, primaryClass={cs.CL}, url={https://arxiv.org/abs/2410.01794}, } ``` ", Assign "at most 3 tags" to the expected json: {"id":"9170","tags":[]} "only from the tags list I provide: [{"id":77,"name":"3d"},{"id":89,"name":"agent"},{"id":17,"name":"ai"},{"id":54,"name":"algorithm"},{"id":24,"name":"api"},{"id":44,"name":"authentication"},{"id":3,"name":"aws"},{"id":27,"name":"backend"},{"id":60,"name":"benchmark"},{"id":72,"name":"best-practices"},{"id":39,"name":"bitcoin"},{"id":37,"name":"blockchain"},{"id":1,"name":"blog"},{"id":45,"name":"bundler"},{"id":58,"name":"cache"},{"id":21,"name":"chat"},{"id":49,"name":"cicd"},{"id":4,"name":"cli"},{"id":64,"name":"cloud-native"},{"id":48,"name":"cms"},{"id":61,"name":"compiler"},{"id":68,"name":"containerization"},{"id":92,"name":"crm"},{"id":34,"name":"data"},{"id":47,"name":"database"},{"id":8,"name":"declarative-gui "},{"id":9,"name":"deploy-tool"},{"id":53,"name":"desktop-app"},{"id":6,"name":"dev-exp-lib"},{"id":59,"name":"dev-tool"},{"id":13,"name":"ecommerce"},{"id":26,"name":"editor"},{"id":66,"name":"emulator"},{"id":62,"name":"filesystem"},{"id":80,"name":"finance"},{"id":15,"name":"firmware"},{"id":73,"name":"for-fun"},{"id":2,"name":"framework"},{"id":11,"name":"frontend"},{"id":22,"name":"game"},{"id":81,"name":"game-engine "},{"id":23,"name":"graphql"},{"id":84,"name":"gui"},{"id":91,"name":"http"},{"id":5,"name":"http-client"},{"id":51,"name":"iac"},{"id":30,"name":"ide"},{"id":78,"name":"iot"},{"id":40,"name":"json"},{"id":83,"name":"julian"},{"id":38,"name":"k8s"},{"id":31,"name":"language"},{"id":10,"name":"learning-resource"},{"id":33,"name":"lib"},{"id":41,"name":"linter"},{"id":28,"name":"lms"},{"id":16,"name":"logging"},{"id":76,"name":"low-code"},{"id":90,"name":"message-queue"},{"id":42,"name":"mobile-app"},{"id":18,"name":"monitoring"},{"id":36,"name":"networking"},{"id":7,"name":"node-version"},{"id":55,"name":"nosql"},{"id":57,"name":"observability"},{"id":46,"name":"orm"},{"id":52,"name":"os"},{"id":14,"name":"parser"},{"id":74,"name":"react"},{"id":82,"name":"real-time"},{"id":56,"name":"robot"},{"id":65,"name":"runtime"},{"id":32,"name":"sdk"},{"id":71,"name":"search"},{"id":63,"name":"secrets"},{"id":25,"name":"security"},{"id":85,"name":"server"},{"id":86,"name":"serverless"},{"id":70,"name":"storage"},{"id":75,"name":"system-design"},{"id":79,"name":"terminal"},{"id":29,"name":"testing"},{"id":12,"name":"ui"},{"id":50,"name":"ux"},{"id":88,"name":"video"},{"id":20,"name":"web-app"},{"id":35,"name":"web-server"},{"id":43,"name":"webassembly"},{"id":69,"name":"workflow"},{"id":87,"name":"yaml"}]" returns me the "expected json"