Giter Site home page Giter Site logo

llm-assignment-proton's Introduction

ProtonDatalabs AI developer Assignment - Chatbot application

Assumption made

User will upload at least one file before starting a chat with a bot. File selection/upload and a chat message is mandatory to proceed with the bot.

The Approach to completing the assignment

Backend

First I updated the predict function in main.py to receive data from the frontend. Then I added logging functionality to log Info level logs in file. Then I saved the received file in the uploads folder. Calculated metadata for this file like file hash, file size, file type, etc. As this data will help us later in identifying whether the file was previously uploaded, size is below 100MB and type of the file is among the accepted file type i.e .csv, .txt, .docx and .pdf. This data is uploaded to the Mongo Atlas DB to refrence later as well as keep track of this data. Once everything is as expected this file will be further processed to create vector embeddings and then store in vectorstore, in our case ChromaDB. If this file was referred earlier no processing will be carried out on that file instead it will refer previously created vector embeddings. Now whenever a query is made on this file, the most relevant data will be gathered and passed as a context and the query itself to the LLM which is in our case gpt-3.5-turbo. This prompt along with history of previous query and response will be created using LangChain library. Exception for this is only csv file which is passed directly to pandasai which is utilizing the same LLM and its independent sets of tools. This app is further deployed in AWS EC2 instance and configured under gunicorn and Apache2.

Tech Stack and Libraries

Python 3.10, FastAPI, Pypdf2, Pandasai, Langchain, ChromaDB, MongoDB, Gunicorn and Apache2

Frontend

First I updated the file input to accept desired file types only i.e .csv, .txt, .docx and .pdf. Added validation to check whether file is below 100MB and of desired file type only. Created chat window, file attach button, message box and a send button. Added a Dark Theme for asthetic purpose. Added a custom scrollbar. Added an indicator for file Referring at. Added toast as notifications for user-friendly alerts. Bot and user chat bubbles added in chat window. Most of the components are used from Chakra UI Library. Updated fetch endpoint. Updated UI for good look. This is further deployed in AWS S3 Bucket.

Tech Stack and Libraries

React, ChakraUI and AWS S3

llm-assignment-proton's People

Contributors

rahul2991 avatar dependabot[bot] 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.