An AI fact checker web application designed with React, LangGraph, and Tavily AI.
https://skang188144.github.io/FakeNewsDetector/
- Video Summary
- Overview
- Project Goals
- System Architecture
- Technical Challenges and Solutions
- Conclusion
- Usage
- License
- Contact
FakeNewsDetector is a fact checker web application designed to determine if a given claim is true or false. This application leverages Retrieval-Augmented Generation to supplement existing large language models with sources from the Internet, allowing these models to make better decisions on whether a statement is true or false, based on what the majority of the sources conclude.
- Fact Checking: Determine the truthfulness or falsity of a claim using large language models.
- Retrieval-Augmented Generation: Supplement the decision-making process with external sources to mitigate hallucinations common in LLMs.
- User-Friendly Interface: Provide a clean and easy-to-use user interface to interact with the application.
This application is designed with a series of specialized agents nodes within a graph to process user queries:
- User Query: the user inputs their claim.
- Filtering Agents: the Grammatical, Proposition, Opinion, Public Knowledge, and Opinion filter agents all work to stop invalid or malformed queries.
- Searcher Agent: the Searcher agent uses the Tavily AI tool to retrieve sources relevant to the query from the Internet.
- Fact Checker Agent: the Fact Checker agent analyzes sources, counts agreements and disagreements, and makes a final determination.
- Graph State Management: Encountered an issue figuring out how to access the graph's state in the middle of a graph's run. Specifically, for the React App component to be updated with the right elements for the loading screen, I needed to store that state using a useState hook, and modify that state at each node of the graph. Although this is most likely bad practice, with the limited time that I had, I decided to apply a quick fix by simply feeding the FakeNewsDetector object with the React setState method, and maintained that method in the internal graph state.
- Accessing External Sources: Another issue was with the ChatGPT model being reluctant to actually crawl through the provided sources. After some research, it seemed like others have had similar issues with ChatGPT 4 being reluctant to search through URLs that were directly provided to it. I tried a number of different solutions, including many Web Loaders in the LangChain library such as Cheerio or Puppeteer, but it seems to be deprecated or non-functioning. This was a bit of a weird problem, but one that I would definitely try to fix given more time.
Despite the challenges and tight deadlines, this project has been a valuable learning experience, allowing me to hone my skills in AI, web development, and project management. Whether or not I get the position at Tavily, I believe this project can stand on its own as a testament to my growth and capability.
You can use FakeNewsDetector at https://skang188144.github.io/FakeNewsDetector/
To build the project on your own,
- Install Node.js
- Clone the repository:
git clone https://github.com/skang188144/FakeNewsDetector.git
- Create your own .env file with the following API keys
VITE_OPENAI_API_KEY=your_openai_api_key VITE_TAVILY_API_KEY=your_tavily_api_key
- Install dependencies
npm install
- Run the development server
npx vite
FakeNewsDetector is licensed under the MIT License.
For inquiries or suggestions, contact the developer at [email protected].