🤖️ A Q&A application based on the local knowledge base implemented using the idea of langchain. The goal is to build a Q&A solution for the knowledge base that is friendly to Chinese scenarios and open source models and can run offline.
💡 Inspired by GanymedeNil's project document.ai and the ChatGLM-6B Pull Request created by Alex Zhangji, a local knowledge base Q&A application that can be implemented using an open source model is established throughout the process. In the latest version of this project, FastChat is used to access Vicuna, Alpaca, LLaMA, Koala, RWKV and other models, relying on the langchain framework to support calling services through the API provided by FastAPI, or use the WebUI based on Streamlit for operations.
✅ Relying on the open source LLM and Embedding models supported by this project, this project can realize offline private deployment using all open source models. At the same time, this project also supports the call of OpenAI GPT API, and will continue to expand the access to various models and model APIs in the future.
⛓️ The implementation principle of this project is shown in the figure below. The process includes loading files -> reading text -> text segmentation -> text vectorization -> question vectorization -> matching in the text vector The top k most similar to the question vector -> the matched text is added to the prompt as the context and the question -> submit to LLM to generate the answer.
Visit Official Website