This project is an API server for performing fact-checking on given texts. When a text is received, it is sent to a queue as a fact-checking task. The fact-checking results are classified into four categories: accurate, inaccurate, false, and indeterminate. The results can be retrieved using the task ID.
- Python 3.8 or higher
- AWS account
- AWS CLI configured with your credentials
-
Clone the repository:
git clone https://github.com/HikaruEgashira/fact-checker.git cd fact-checker
-
Install the required dependencies:
pip install -r requirements.txt cp config/pre-* .git/hooks
-
Deploy the infrastructure using Terraform:
cd infra/production terraform init terraform apply
To run the API server locally, use the following command:
python src/app.py
- Description: Submit a prompt for fact-checking.
- Request Body:
{ "prompt": "The earth is round." }
- Response:
{ "id": "unique-task-id" }
- Description: Retrieve the fact-checking result for a given task ID.
- Response:
{ "id": "unique-task-id", "result": "accurate" | "almost accurate" | "misleading" | "inaccurate" | "unsupported" | "incorrect" | "false" | "indeterminate" | "out of scope" }
To submit a fact-checking request via the CLI, use the following command:
python src/app.py submit --prompt "The earth is round."
To check the state of a fact-checking task via the CLI, use the following command:
python src/app.py state --id "unique-task-id"