Giter Site home page Giter Site logo

ramamimu / chatbot-api Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 25.74 MB

As final project for my Bachelor, i create RAG (Retrieval Augmented Generation) as back-end service which combine Retrieval and Generation to get information from bunch of documents. The Embedding use model from Huggingface and Text Generation from OpenAI

Python 95.69% Dockerfile 0.82% Makefile 2.30% Mako 1.18%

chatbot-api's Introduction

Chatbot API

how to run manually

if run manually, only supported on unix

  • create virtual environment

    python3 -m venv venv
    
    source venv/bin/activate
    
  • install packages

    Highly recommend to install package manually as put in installer.txt

    or

    pip3 install -r requirements.txt
    
  • create .env such example.env file

  • setup database

    setup the database as put in .env file. then create database name chatbot

    CREATE DATABASE chatbot
    

    or you can simply use docker compose of postgres in compose/postgres.yaml

  • Apply the Alembic migrations

    make migrate-checkout r=head
    
  • download embeeding model

    python3 model.download.py
    
  • embed basic knowledge for vectorstore db

    python3 embed.init.py
    
  • Configure preprocessing file as mention at preprocessing section (optional)

  • run the app

    for development

    python3 app.py
    

    for deployment testing

    fastapi run app.py
    

how to run using docker

  1. create .env such example.env file

  2. Configure preprocessing file as mention at preprocessing section (optional)

  3. run docker compose command

docker compose build --no-cache
docker compose up -d

-d means running as daemon

exposing port 5001 as default

sometimes, the code was error. Keep build the image untill get succeed then compose up

how to add preprocessing file

you need to configure of three things:

  1. create folder name by following rule documents/preprocessing-<your custom name>

  2. provide .pdf file in your directory as downloadable file later on

  3. provide .txt file in your directory which contains .pdf file content as chatbot knowledge due to not all .pdf file is readable

the program will automatically recognize as preprocessing stuff and will be loaded when it get starts.

documentation

Documentation able to see on url/docs. It is generated automatically by fastapi. It also provides API playground.

chatbot-api's People

Contributors

ramamimu avatar

Watchers

Kostas Georgiou avatar  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.