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 usingPDFPlumberLoaderto extract text content. -
Text Chunking:
The extracted text is split into smaller chunks usingRecursiveCharacterTextSplitterto 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
Metadata
Release files for iflow-mcp_ImVirtue-RagChatbot_MCPServer 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| iflow_mcp_imvirtue_ragchatbot_mcpserver-0.1.0.tar.gz | 459.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| iflow_mcp_imvirtue_ragchatbot_mcpserver-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 465.3 kB
Release files / iflow_mcp_imvirtue_ragchatbot_mcpserver-0.1.0.tar.gz
| Download URL | iflow_mcp_imvirtue_ragchatbot_mcpserver-0.1.0.tar.gz |
|---|---|
| Size | 459.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9c76351669efdca219c74a836f49e98a7b6976fc312917fb51c2e4c4bdcf29e8
|
|
BLAKE2b-256 checksum How to use checksums |
b670e8219e2c8d353eb4c8793c30909db502836ce138c3f5e2f3ceaca349e43a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.7.8
|
Release files / iflow_mcp_imvirtue_ragchatbot_mcpserver-0.1.0-py3-none-any.whl
| Download URL | iflow_mcp_imvirtue_ragchatbot_mcpserver-0.1.0-py3-none-any.whl |
|---|---|
| Size | 5.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ec688ddf3164dc6e0fbe56c4378b97d1fd8f4b91309cbdcef1bab9379aa65647
|
|
BLAKE2b-256 checksum How to use checksums |
bdfa9977d93f02736532dcbe0f3e98c731c91a3dad85707483f81a6512b1a0e3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.7.8
|