Skip to content

liangdabiao/ThinkRAG

 
 

Repository files navigation

English | 简体中文

License: MIT support: LanceDB support: Ollama

Table of Contents

What is ThinkRAG 🤔

ThinkRAG is an open-source RAG engine that based on document retrieval.

Key Features ✨

Expand

Knowledge Base Management:

   ThinkRAG allows users to upload, manage, and index content from both files (like PDFs, DOCX, and TXT files) and web pages. This includes setting parameters for text processing to ensure optimal data organization and retrievability.

API Configuration:

   ThinkRAG offers extensive settings for configuring APIs, including setting up service addresses, selecting models, and enabling specific features like re-ranking for embedding models. This facilitates integration and management of various language and embedding models that can be used for enhanced data processing and retrieval within the knowledge base.

Advanced Settings:

   ThinkRAG also includes advanced settings that allow users to further refine system behaviour and interaction modes, such as adjusting response selection criteria and customizing system prompts.

Support LanceDB:

   As a open-source multimodal vector database, LanceDB has following core advantages:

  • Optimized for Time Series Data: Designed specifically for handling time series data, making it ideal for real-time monitoring, IoT device data, financial trading data, and more.
  • High Performance: Offers high data ingestion rates and fast query performance, suitable for real-time analytics.
  • Scalability: Supports horizontal scaling, enabling increased load handling by adding more nodes.
  • Efficient Data Compression: Utilizes advanced data compression techniques to optimize storage and enhance I/O efficiency.
  • Flexible Data Retention Policies: Allows for customizable data retention policies, supporting automatic downsampling or deletion of old data.
  • Robust Query Language: Provides a powerful and flexible query language to facilitate complex data analysis and aggregation directly in the database.
  • Integrated Visualization Tools: May include integrated tools for data visualization and dashboarding, simplifying data monitoring and analysis.

Visit here to learn more about LanceDB.


Demo 📝

Expand Try our demo here!

Quick Start 🛫

Expand

Step 1

pip3 install -r requirements.txt

Step 2

Refer to here to download embedding models and nltk data into localmodels directory

Step 3

If you need LLMs API, please set your corresponding API Key first, see Set API Key for detailed instructions.

Then, run ThinkRAG by the following command (after returning to the root directory of ThinkRAG):

streamlit run app.py

Set API Key ⚙️

MacOS & Linux

Expand

Set Temporary API Key

1. Run the command line in your terminal

export VARIABLE_NAME=value

For instance, to set your API key for OpenAI, just run the following line in your terminal:

export OPENAI_API_KEY=your_OpenAI_API_key 

Set Permanent API Key

1. Create or edit '.zshenv' file

nano ~/.zshenv

For Linux, macOS Mojave (10.14) or earlier version, run

nano ~/.bashrc

2. Add Your Configuration

export VARIABLE_NAME="value"

For instance, to set your API key for OpenAI, just type the following line into your '.zshenv' (or '.bashrc') file:

export OPENAI_API_KEY=your_OpenAI_API_key 

3. Save and exit

You may now save changes by pressing 'Ctrl + O', then press 'Enter' to confirm, and 'Ctrl + X' to exit the editor.

4. Apply the Changes

To ensure the changes take effect in your current terminal session, you can source the file by run

source ~/.zshenv 
# source ~/.bashrc for Linux, macOS Mojave (10.14) or earlier

Windows

Expand

Run the command line in your terminal

set VARIABLE_NAME=value # Set Temporary API Key
setx VARIABLE_NAME "value" -m # Set Permanent API Key

Engine Interface Instructions 📖

Expand

See here for detailed instructions about ThinkRAG's key features and how to use them for your own customized purposes.

Model Support 🪀

Expand

ThinkRAG supports Ollama and the following models were tested. To use these Ollama models, you need to install Ollama on your device.

Install your preferred models

To install your preferred Ollama models, run this command in your terminal:

ollama pull <model_name>

We suggest you to specify the model_name otherwise it will point to the latest, smallest sized-parameter model that fits the name you indicate, which may not be the model you actually want.

Once the installation is complete, you may double-check that viewing all the models you have pulled via:

ollama list

or directly run a certain model via:

ollama run <model_name>

Take gemma:2b for example:

gemma_2b

Supported Ollama models and other LLMs

Ollama models LLMs

gemma:2b

llama2-chinese:13b

llama2:13b

mistral:latest

deepseek-coder:33b

deepseek-coder:latest

gemma:latest

glm-4

glm-4v

glm-3-turbo

moonshot-v1-8k

moonshot-v1-32k

moonshot-v1-128k

deepseek-chat

deepseek-coder

gpt-4

gpt-3.5

gpt-4o


License 📄

ThinkRAG uses MIT License. See here for details.

Future-Plans 🔜

FAQ❓

Contact Us ☎️

Official WeChat Account

About

A LLM RAG application based on LlamaIndex and Streamlit. Optimized for Chinese users by adopting BAAI embedding / reranker models, Ollama local models and using LLM API from Chinese LLM service providers like Zhipu, DeepSeek and Moonshot.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Python 100.0%