AI Developer Practical Assessment
Objective: Build a mini Retrieval-Augmented Question Answering RAG app that can answer questions from a set of PDF documents using embeddings and an LLM API (can use OpenAI / Gemini / Hugging Face).
TOOLS:
LLM MODEL = Google Gemini
EMBEDDINGS = HuggingFaceEmbeddings
VECTORDB = Faiss
CODE EXPLANATION:
I have added two functions create_vector_db and get_qa_chain.
create_vector_db:
get pdf documents from the folder
clean the text
split into chunks
then add embeddings for each chunks
stores and save in a vectordb (FAISS)
get_qa_chain:
loads the saved vectordb(FAISS)
User's questions converted into embeddings
get the top 3 similar chunks from the vectordb using retriever
create a prompt template
give the prompt template along with the similar context to the llm
llm will regenerate the response based on the available context