Giter Site home page Giter Site logo

llm_chatbot's Introduction

Chatbot LLM Project

This project implements a chatbot using a GPT-2 language model. The chatbot is trained on a combined dataset of question-answer pairs and dialogue exchanges, enabling it to handle various conversational contexts. The backend is built using FastAPI, and the frontend is a simple ReactJS application.

As of now this is day 1 effort that's committed as initial commit. Its still not able to generate correct responses and has still a long way to go.

Table of Contents

Requirements

  • Python 3.8 or higher
  • Node.js and npm
  • pip (Python package installer)

Installation

  1. Clone the repository:

    git clone https://github.com/yourusername/chatbot-llm.git
    cd chatbot-llm
  2. Set up the Python environment:

    python -m venv venv
    source venv/bin/activate  # On Windows use `venv\Scripts\activate`
    pip install -r requirements.txt
  3. Set up the ReactJS frontend:

    cd llm_frontend
    npm install
    cd ..

Data Preparation

  1. Create your datasets:

    • qa_dataset.json (example):
    [
        {"question": "What is AI?", "answer": "AI stands for Artificial Intelligence."},
        {"question": "Who wrote '1984'?", "answer": "George Orwell wrote '1984'."}
    ]
    • dialogue_dataset.json (example):
    [
        {"context": "Hello! How can I help you today?", "response": "Hi! I'm looking for information on your services."},
        {"context": "Sure, what do you need help with?", "response": "Can you tell me more about your pricing plans?"}
    ]
  2. Preprocess the datasets:

    python preprocess.py

Training the Model

Train the GPT-2 model on the combined dataset:

python train.py

Running the Backend

  1. Ensure the virtual environment is activated:
source venv/bin/activate  # On Windows use `venv\Scripts\activate`
  1. Start the FastAPI server:
uvicorn main:app --reload

Running the Frontend

  1. Navigate to the frontend directory:
cd llm_frontend
  1. Start the React application:
npm start

Testing the Chatbot

  1. Open your browser and navigate to http://localhost:3000.
  2. Enter a prompt in the input field and click "Submit".
  3. The chatbot should respond based on the trained model.

llm_chatbot's People

Contributors

1231varun avatar

Watchers

 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.