ColossalAI/applications/ColossalQA/examples/webui_demo
YeAnbang e53e729d8e
[Feature] Add document retrieval QA (#5020)
* add langchain

* add langchain

* Add files via upload

* add langchain

* fix style

* fix style: remove extra space

* add pytest; modified retriever

* add pytest; modified retriever

* add tests to build_on_pr.yml

* fix build_on_pr.yml

* fix build on pr; fix environ vars

* seperate unit tests for colossalqa from build from pr

* fix container setting; fix environ vars

* commented dev code

* add incremental update

* remove stale code

* fix style

* change to sha3 224

* fix retriever; fix style; add unit test for document loader

* fix ci workflow config

* fix ci workflow config

* add set cuda visible device script in ci

* fix doc string

* fix style; update readme; refactored

* add force log info

* change build on pr, ignore colossalqa

* fix docstring, captitalize all initial letters

* fix indexing; fix text-splitter

* remove debug code, update reference

* reset previous commit

* update LICENSE update README add key-value mode, fix bugs

* add files back

* revert force push

* remove junk file

* add test files

* fix retriever bug, add intent classification

* change conversation chain design

* rewrite prompt and conversation chain

* add ui v1

* ui v1

* fix atavar

* add header

* Refactor the RAG Code and support Pangu

* Refactor the ColossalQA chain to Object-Oriented Programming and the UI demo.

* resolved conversation. tested scripts under examples. web demo still buggy

* fix ci tests

* Some modifications to add ChatGPT api

* modify llm.py and remove unnecessary files

* Delete applications/ColossalQA/examples/ui/test_frontend_input.json

* Remove OpenAI api key

* add colossalqa

* move files

* move files

* move files

* move files

* fix style

* Add Readme and fix some bugs.

* Add something to readme and modify some code

* modify a directory name for clarity

* remove redundant directory

* Correct a type in  llm.py

* fix AI prefix

* fix test_memory.py

* fix conversation

* fix some erros and typos

* Fix a missing import in RAG_ChatBot.py

* add colossalcloud LLM wrapper, correct issues in code review

---------

Co-authored-by: YeAnbang <anbangy2@outlook.com>
Co-authored-by: Orion-Zheng <zheng_zian@u.nus.edu>
Co-authored-by: Zian(Andy) Zheng <62330719+Orion-Zheng@users.noreply.github.com>
Co-authored-by: Orion-Zheng <zhengzian@u.nus.edu>
2023-11-23 10:33:48 +08:00
..
img [Feature] Add document retrieval QA (#5020) 2023-11-23 10:33:48 +08:00
RAG_ChatBot.py [Feature] Add document retrieval QA (#5020) 2023-11-23 10:33:48 +08:00
README.md [Feature] Add document retrieval QA (#5020) 2023-11-23 10:33:48 +08:00
server.py [Feature] Add document retrieval QA (#5020) 2023-11-23 10:33:48 +08:00
start_colossal_qa.sh [Feature] Add document retrieval QA (#5020) 2023-11-23 10:33:48 +08:00
webui.py [Feature] Add document retrieval QA (#5020) 2023-11-23 10:33:48 +08:00

README.md

ColossalQA WebUI Demo

This demo provides a simple WebUI for ColossalQA, enabling you to upload your files as a knowledge base and interact with them through a chat interface in your browser.

The server.py initializes the backend RAG chain that can be backed by various language models (e.g., ChatGPT, Huawei Pangu, ChatGLM2). Meanwhile, webui.py launches a Gradio-supported chatbot interface.

Usage

Installation

First, install the necessary dependencies for ColossalQA:

git clone https://github.com/hpcaitech/ColossalAI.git
cd ColossalAI/applications/ColossalQA/
pip install -e .

Configure the RAG Chain

Customize the RAG Chain settings, such as the embedding model (default: moka-ai/m3e) and the language model, in the start_colossal_qa.sh script.

For API-based language models (like ChatGPT or Huawei Pangu), provide your API key for authentication. For locally-run models, indicate the path to the model's checkpoint file.

If you want to customize prompts in the RAG Chain, you can have a look at the RAG_ChatBot.py file to modify them.

Run WebUI Demo

Execute the following command to start the demo:

bash start_colossal_qa.sh

After launching the script, you can upload files and engage with the chatbot through your web browser.

ColossalQA Demo