Use Gemini or Mistral AI to build a chatbot using RAG to improve AI response.
LangChain is used to build the pipeline for LLM. The context information is stored in context.txt
. The information from knowledge document is converted into vectors and stored in Pinecone (a vector database). This facilitates accurate response generation by offering a way to identify and fetch relevant information from the vector db quickly. The LLM uses this additional information to formulate the response. The web UI is developed using Streamlit.
To run this file, first download the dependencies
pip install -r requirements.txt
You need to update .env file with your Pinecone API and HuggingFace Access Token. If you don't have one, you need to create a free account on both the websites and then create an API and an access token respectively.
Update PINECONE_API_KEY
and HUGGINGFACE_API_KEY
in .env file.
Here, I have used MistralAI API available on HuggingFace. To use another LLM for your ChatBot, replace the repo_id
in main.py with that of the desired LLM from HuggingFace.
After completing the authentication steps, main.py is ready to run using the following code
python main.py
- Create a web UI frontend
- Make it General Purpose IR from doc/pdf uploaded by user
- Add functionality to upload and retrieve information from images