An intelligent search system based on RAG (Retrieval-Augmented Generation) that supports multiple LLM models, including GPT and local Ollama models.
For Chinese version, please check README_cn.md
- Support for multiple LLM models (GPT and local Ollama models)
- Streaming output generation
- Display of reference document sources
- History record saving and querying
- Responsive interface design
- Optimize real-time search
- Optimize generation result efficiency, such as first detecting whether to search, then searching, otherwise directly generating
- Support for multi-round dialogue
- Python 3.8+
- Flask
- Azure OpenAI API access (for GPT)
- Ollama service (for local models)
- Clone the project
git clone https://github.com/your-repo/rag-ai-search.git
- Install dependencies
pip install -r requirements.txt
- Install Ollama
-
Install Ollama
Reference: Ollama Installation
-
Install Ollama model after installation
ollama run llama3:8b
-
Configure Ollama service address
Configure Ollama service address in config/settings.py
OllamaConfig.BASE_URL = "http://127.0.0.1:4008"
- Install Search Engine
-
Install search engine
Reference: Install Search Engine
-
Configure search engine
Configure search engine in config/settings.py
SearchConfig.SEARX_BASE_URL = "http://127.0.0.1:11434"
-
Configure Azure OpenAI API
Create a .env file in the project root directory and configure the following environment variables:
gpt4o_mini_api_key='your_api_key'
gpt4o_mini_api_version='your_api_version'
gpt4o_mini_azure_endpoint='your_azure_endpoint'
GPT calling method: utils/gpt4_client.py
Note: If you don't have a GPT key, you can directly use the Ollama model without configuring Azure OpenAI
- Start Web Service
python web/app.py
-
Open browser and visit: http://localhost:5000
-
Select Model:
- GPT: Uses Azure OpenAI service
- Ollama Model: Uses locally deployed model
-
Enter your question and wait for the answer
- System will display reference document sources
- Real-time streaming display of generated results
- Support for viewing history records