Collaborators: Nick Ching (nc2935), Naren Loganathan (nl2878), Suwei Ma (sm5011), Avery Fan (mf3332)
Contributions + Tasks: Trello Board
Veritas is a lightweight and flexible service that abstracts the task of detecting AI-generated text in various contexts. Utilizing the cutting edge paper: Raidar: geneRative AI Detection viA Rewriting published by Mao, Vondrick, Wang, and Yang.
- 18 Oct 2024: Completed development of Veritas service (including Java API controller, DB handlers and Python Microservice)
- 28 Nov 2024: Furthered development of Veritas service with an authentication mechanism, developed BotBuster client which employs our service, finalized endpoints
BotBuster Linked Here: https://github.com/nick-ching23/BotBuster/tree/main
Veritas's Service utilizes a modular microservice design:
- Java Springboot API Handler: controls all business service logic, handling interactions with the ML model and our persistent storage
- Python ML microservice: this microservice is solely responsible for detecting AI-generated text. It is deployed on a separate GCP VM so and interacted with through HTTP
- Cloud SQL on GCP: The final component of our service is persistent storage, hosted on GCP.
-
Java Development Kit (JDK): Version 17 or later
- Ensure that javac and java are installed and properly configured in your system's PATH.
- you can verify this by running
javac --version
andjava-version
-
Maven: Used for building the project
- Maven should be installed and accessible via the CLI
- you can verify this by running
mvn --version
-
Python 3.11 or later: For deploying the Veritas microservice:
- You can check your version using
python3 --version
- You can check your version using
-
Intellij: Note that this project was built using Intellij IDEA, but it should work with any Java-compatible IDE.
- Clone the GitHub repo, open the
veritas
directory in IntelliJ, run the default generated run configuration forVeritasApplication
from the IDE. - Tests can be run (
mvn test
) without the extra DB/flask server setup (since we mock). Checkapplication.yaml
for the additional env vars required otherwise. - Set up a MySQL database (we use Cloud SQL), set the
DB_URL
,DB_USERNAME
andDB_PASSWORD
environment variables accordingly. - ML Microservice: Create a python3 venv (we did this on a separate GCP VM)
python3 -m venv <env-name>
, runpip install -r requirements.txt
from thecheck-gpt
directory and start up the flask server by runningpython3 app.py
. - Get the URL for the server and set the
MODEL_MICROSERVICE_URL
env var accordingly.
- Endpoint information is described in the next section. We use Postman to craft our requests and point it at the URL we obtain when we start up Veritas.
- At the moment, we have our service running on a GCP VM. Paste http://34.70.245.192:8080 in your browser to see 'Welcome to Veritas!'. You can use the endpoint descriptions to make other types of requests.
GET: /
POST: /checkText
POST: /checkTextUser
GET: /numFlags
POST: /register
POST: /login
Note: we have incorporated login functionality. Each valid user and organization will need to re-enter their credentials every 24 hours. This check has been integrated into each of our endpoints.
Run mvn test
on the command line from the veritas
directory. As of now, this runs 33 tests with high branch coverage. We have 3 suites of unit tests for the VeritasController
, VeritasRecord
and VeritasService
classes.
We use pmd as our static bug finder. Run mvn pmd::check
from the veritas
directory. Here is the report
as of the day of 11/28/2024 (These can be found in the reports folder):
We used the tool "checkstyle" to check the style of our code and generate style checking reports. Run mvn checkstyle:check
from the veritas
directory. Here is the report
as of the day of 11/28/2024 (These can be found in the reports folder):
We used JaCoCo to perform branch analysis in order to see the branch coverage of the relevant code within the code base. Run mvn jacoco:report
from the veritas
directory and open (in browser) the index.html
that gets generated at target/site/jacoco
. See below for a screenshot of the output - indicating high branch coverage.
- Maven
- GitHub Actions CI: Current workflow runs a Maven build + tests to make sure pushed code doesn't break
- Checkstyle: Style checking
- JUnit: Unit testing
- PMD: Static Code Analysis
- Mybatis Mapper: Allows us to perform SQL queries by specifying a Java map.
- JaCoCo: Code coverage report generation
- Postman: API testing