Agent-RAG is a chatbot project that allows users to upload PDF documents and ask questions about them through a chatbot interface. The system uses RAG and advanced techniques to provide the most accurate answers.
Chatbot processing flow
- Easy to run locally and online API
- Supports uploading one or multiple PDF files
- Combines multiple retrieval and re-ranking methods
- User-friendly interface built with Streamlit
- Requires Python version 3.9 or higher
- Ollama is used to run the chatbot locally (Download)
- OpenAI API key is used to run the chatbot through API(Register)
- The Langchain API key is used for tracing and debugging the LLM (Register)
git clone https://github.com/tuanbeba/Agent-Rag
cd Agent-Ragpip install -r requirements.txtCreate a .env file in the project root and add the required configuration values:
#OpenAI API key
OPENAI_API_KEY= <Your API key>
#Lang Smith
LANGCHAIN_TRACING_V2=true
LANGCHAIN_ENDPOINT="https://api.smith.langchain.com"
LANGCHAIN_API_KEY=<Your langchain API key>
LANGCHAIN_PROJECT=<Your project name>streamlit run src/main.pyYou can view the application at Local URL: http://localhost:8501
If you choose the online option, the system will use OpenAI's chat model and embedding model. If you choose the local option, it will use Ollama's chat model and embedding model. You can read more in the Ollama documentation here and the OpenAI documentation here.
If you want to add more models, please check here.
Upload one or more PDF documents that you want to query.
Click the Upload File button to save your document to the database. If the file is uploaded successfully, the message Files uploaded successfully! will be displayed.
Type your question and press Enter to submit.
You can customize various parameters of the system in the settings.py and option_model.py files.
If you want to add more models modify option_model.py
If you want to change the number of documents retrieved, use rerank or not, modify settings.py
├──README.md
├──requirement.txt
├──chroma_test
├──image
└──src
│ ├───agent.py
│ ├───main.py
│ ├───options_model.py
│ ├───setting.py
│ └───vectorstore.py

