
Rag chatbot with a localhost MCP server
Building an Rag-based HR chatbot for providing rules in workplace with MCP server
What is RagChatbot?
RagChatbot is a Retrieval-Augmented Generation (RAG) based HR chatbot designed to provide workplace rules and information through a localhost MCP server.
How to use RagChatbot?
To use RagChatbot, upload a PDF file containing workplace rules, and the chatbot will retrieve relevant information to answer your questions in natural language.
Key features of RagChatbot?
- MCP Tool Integration: Ensures smooth communication between document indexing, retrieval, and answer generation.
- PDF Upload and Parsing: Users can upload PDF files which are parsed to extract text content.
- Text Chunking: Extracted text is split into smaller chunks for efficient indexing and retrieval.
- Document Indexing: Chunks are indexed in an in-memory vector store with embeddings generated via OpenAI.
- Similarity Search: Performs a similarity search to retrieve relevant document chunks based on user queries.
- Prompt-Based Answer Generation: Combines user questions with retrieved context to generate answers using GPT-4.
- Interactive Interface: Provides a chat-like interface for user interaction.
Use cases of RagChatbot?
- Providing HR-related information and rules to employees.
- Assisting in onboarding processes by answering common questions.
- Retrieving specific workplace policies from uploaded documents.
FAQ from RagChatbot?
- Can RagChatbot handle all types of documents?
Currently, it supports PDF files for extracting workplace rules and information.
- Is RagChatbot free to use?
Yes! RagChatbot is free to use for everyone.
- How accurate are the answers provided by RagChatbot?
The accuracy depends on the quality of the uploaded documents and the clarity of the user queries.
Rag chatbot with a localhost MCP server
Building a RAG-based HR chatbot for providing rules in the workplace with the localhost MCP server as a function-calling hub
Overview
This project implements a Retrieval-Augmented Generation (RAG) chatbot using Streamlit and the MCP server. Users can upload PDF files, and the chatbot retrieves relevant information from the PDFs to answer natural language questions. The system leverages OpenAI models, LangChain utilities, and an in-memory vector store for efficient document retrieval.
Features
-
MCP Tool Integration:
Tool orchestration with MCP ensures smooth communication between document indexing, retrieval, and answer generation. The backend tools can be extended or replaced easily as new functionalities are added. -
PDF Upload and Parsing:
Upload a PDF file which is then parsed usingPDFPlumberLoader
to extract text content. -
Text Chunking:
The extracted text is split into smaller chunks usingRecursiveCharacterTextSplitter
to facilitate efficient indexing and retrieval. -
Document Indexing:
Chunks are indexed in an in-memory vector store with embeddings generated viaOpenAIEmbeddings
. -
Similarity Search (Consine Similarity):
When a user submits a query, the chatbot performs a similarity search to retrieve the most relevant document chunks based on the query. -
Prompt-Based Answer Generation:
A custom prompt template combines the user question with retrieved context, and a GPT-4 powered LLM (usingChatOpenAI
) generates the final answer. -
Interactive Interface:
The application uses Streamlit to provide an interactive, chat-like interface where user questions and bot responses are displayed.
Result
