GithubHelp home page GithubHelp logo

maniveergit / question-answering-api-llm Goto Github PK

View Code? Open in Web Editor NEW

This project forked from di37/question-answering-api-llm

0.0 0.0 0.0 2.51 MB

Question Answering System API based on all of the Harry Potter Books that will allow to answer all the events that took please in the Harry Potter universe.

Shell 2.55% Python 90.98% Dockerfile 6.46%

question-answering-api-llm's Introduction

Building Harry Potter based Question and Answering API

Motivation

After release of ChatGPT, a lot of people have asked why not we get specific question answer systems/bots for specific area of interest. In this project, we will be building an API that will answer questions about Harry Potter related questions from Harry Potter books.

Brief Introduction about LangChain and GPT Index

Use of large language models (LLMs) is becoming increasingly prevalent in the development of powerful applications. These models allow developers to build applications that were not previously possible due to their ability to understand and process natural language. However, while LLMs on their own are impressive, their true potential lies in their ability to be combined with other sources of computation or knowledge. This is where this library - langchain comes in. It aims to assist developers in the creation of such applications by providing tools to combine large language models with other sources of information. Through this combination, developers can unlock the full potential of LLMs and create truly transformative applications.

GPT Index (LlamaIndex ๐Ÿฆ™), is a collection of data structures that simplify the usage of large external knowledge sources with large language models.

These two libraries will enable us to build question and answering model by accessing LLM and fine-tune it for our purpose.

Running the API on Docker Container

  • Sign up in OpenAI website and get your API key.
  • .env must contain the OPENAPI KEY and paths. Sample included. For production purpose, .env file should be included in .gitignore file.
  • Run the docker container:
docker compose up
  • If any changes made to the code, then run following command for the code changes to be reflected in the docker container.Then, we can run the above command.
docker compose build
  • On your web browser, go to http://localhost:9001/docs and you will see the documentation. alt text
  • Make POST request for generating index file. alt text
  • If index file is generated, then we will get following response. alt text
  • Ensure the items directory is having following tree structure:
items
โ”œโ”€โ”€ data
โ”‚   โ””โ”€โ”€ harry_potter_corpora_1_to_7.txt
โ””โ”€โ”€ index_folder
    โ””โ”€โ”€ index.json
  • Now we are ready to ask questions to the system for which also, we need to make POST request. Sample as follows. alt text

Resources

Important Note

This project is created exclusively for educational purpose. Data is strictly not to be used for commercial purposes.

question-answering-api-llm's People

Contributors

di37 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.