Giter Site home page Giter Site logo

badfaith's Introduction

Badfaith - Logical Fallacy Detector

Deployed at: https://badfaith.io/ (The project is deployed with Vercel and one of the current limitations is Vercel's 10 second serverless function limit for free users. This results in prompts often timing out if OpenAi API takes too long to respond, I'm trying to find a solution to this)

Screenshots

Landing Page

Text input area

Report Example

Tech Stack

MongoDB Next.js React Node.js OpenAI

About

This project aims to assist users in identifying potential logical fallacies and manipulation tactics within articles or written content. By leveraging the power of OpenAI's API, the application can process large amounts of text and highlight questionable sections for further review.

Features

  • Text Analysis: Paste an article and get instant feedback on potential fallacies.
  • User-friendly Interface: Designed with a focus on user experience, making it easy to navigate and understand the analysis results.
  • Real-time Feedback: As soon as an article is pasted, the analysis process begins, delivering results in real-time.
  • Secure and Fast: Built using Next.js, the app ensures efficient server-side rendering and top-notch security.

Installation and Setup

  1. Clone the repository:

    git clone https://github.com/ParisMonson/badfaith.git
  2. Navigate into the directory:

cd badfaith
  1. Install dependencies:

    npm install
  2. Set up environment variables: The project uses an OpenAi API key variable, MongoDB API variables and auth0 variables. For local usage you would need to have your own OpenAi API key. MongoDb is used to store previous article analysis for logged in users so is not needed for local usage. Same with auth0.

You would need to add your own OpenAi API key to the .env.local file if you wish to test this locally.

  1. Run locally:

    npm run dev
  2. Visit http://localhost:3000 to see the app running.

Usage

Simply paste in the article title and content into the relavant sections of the app and press "Analyse".

As mentioned above the current limitation is Vercels 10 second timelimit on serverless functions. THis results in promts often timing out if OpenAi takes to long to respond.

Under the Hood: Wrapping Around ChatGPT

The core functionality of this application is centered around sending a request to OpenAI's ChatGPT with a unique prompt structure that allows us to analyze articles for logical fallacies and manipulation tactics. Here's a deeper dive into how it works:

Sending the Request

The backend file sends a request to OpenAI using the openai.createChatCompletion() method. It communicates with the GPT-3.5-turbo model, known for its exceptional ability to generate human-like responses.

The Prompt

The most important part of this interaction is the generatePrompt function:

function generatePrompt(articleTitle, article) {
  return `You are going to analyse articles for the following manipulation tactics and logical fallacies...
  ...
  The article title is: ${articleTitle};
  Here is the Article: ${article}`;
}

This function creates a prompt that:

  1. Instructs ChatGPT: It lays out a clear instruction for the model, letting it know the manipulation tactics and logical fallacies it should watch out for.
  2. Sets Clear Criteria: It ensures that ChatGPT understands the grading system based on the badfaith score.
  3. Structures the Response: It specifies the format in which the report should be generated, ensuring a consistent user experience.

Response Handling Once the response is received from OpenAI:

If there's an authenticated user session, it creates a report using the createReport utility function. The result is then sent as a JSON response to the frontend for display.

badfaith's People

Contributors

abshek17 avatar deadex-ng avatar dependabot[bot] avatar jeevnayak avatar logankilpatrick avatar parismonson avatar pathree avatar schnerd avatar shiba-hiro avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.