About this project

Langchain-Chatchat (formerly Langchain-ChatGLM) is an open-source, offline-deployable RAG (Retrieval-Augmented Generation) and Agent application project built on the Langchain framework and large language models such as ChatGLM, Qwen, and Llama. Its goal is to establish a knowledge base Q&A solution that is friendly to Chinese scenarios and open-source models and can run completely offline. The core principle process is: load files, read text, split text, vectorize text, vectorize the question, match the top k most similar texts in the vector database, add the matched texts as context together with the question into the prompt, and submit to the LLM to generate an answer. The project itself does not involve fine-tuning or training, but fine-tuning can be used to optimize results. The 0.3.x version features include: LLM conversation, knowledge base conversation, search engine conversation, file conversation (unified as File RAG, supporting multiple retrieval methods such as BM25+KNN), database conversation, multimodal image conversation, ARXIV literature conversation, Wolfram conversation, text-to-image, local knowledge base management, and WebUI. Core functions are implemented by Agent, and users can also manually invoke tools, supporting different modes such as automatic tool invocation, parsing only tool parameters, and manual parameter filling. In terms of model integration, 0.3.x no longer loads models directly from local paths, but instead integrates through mainstream model inference frameworks, including Xinference, LocalAI, Ollama, FastChat, and the online API framework One API (supporting OpenAI, Azure OpenAI, Anthropic Claude, Zhipu Qingyan, Baichuan, etc.). All model integrations are compatible with the OpenAI SDK. Deployment methods include pip installation (pip install langchain-chatchat -U), source installation/development deployment, and Docker deployment. The usage process includes: start the model inference framework and load models, run chatchat init to initialize configuration and data directories, modify configuration files such as model_settings.yaml, run chatchat kb -r to initialize the knowledge base, and run chatchat start -a to start the project. The project supports Python 3.8-3.11 and runs on Windows, macOS, and Linux, with hardware support for CPU, GPU, NPU, and MPS. The project code is licensed under Apache-2.0. Milestones include the release of 0.1.0 in April 2023, renaming and release of 0.2.0 in August 2023, surpassing 20K stars in December 2023, and the release of the brand-new architecture 0.3.0 in June 2024.