Spaces:
Sleeping
Sleeping
|
Download README.md from YADUUG/NPS-ChatAgentBot: direct link, hf CLI and curl.
- Browser
- Download file 4.2 kB
-
https://huggingface.co/spaces/YADUUG/NPS-ChatAgentBot/resolve/main/README.md
- Command line
-
hf download hf://spaces/YADUUG/NPS-ChatAgentBot/README.md
-
curl -L -o README.md https://huggingface.co/spaces/YADUUG/NPS-ChatAgentBot/resolve/main/README.md
4.2 kB
metadata
title: NPS-AI
emoji: π
colorFrom: indigo
colorTo: yellow
sdk: docker
pinned: false
NPS-ChatAgentBot (NPS-AI)
Welcome to the NPS-ChatAgentBot repository! This project (also referred to as GNDU Assistant) is a comprehensive AI solution combining a Retrieval-Augmented Generation (RAG) Chatbot and an Autonomous Web Browser Agent. It is built using Python, FastAPI, LangChain, and state-of-the-art Large Language Models (LLMs) like Mistral AI and local Ollama models.
π Key Features
RAG-Powered Chatbot:
- Uses the Mistral AI API to answer queries accurately based on uploaded documents (PDF, DOCX, TXT, MD).
- Custom
EnsembleRetrievercombining Scikit-Learn's TF-IDF for keyword matching and FAISS for semantic similarity (using HuggingFace embeddings). - Multi-language Support: Automatically translates non-English queries to English for internal processing, and translates the generated answer back to the user's language using Mistral.
Autonomous Web Browser Agent:
- Uses an autonomous web browsing framework (integrated via
nps_agent.py) to search the web, navigate pages, and extract information. - Powered by a local Ollama LLM (default model:
kimi-k2.5:cloud), ensuring privacy and saving API costs. - The agent is accessible via a dedicated
/agent/runendpoint or via a standalone script.
- Uses an autonomous web browsing framework (integrated via
FastAPI Backend & Frontend Integration:
- Modern, fast, and robust backend using FastAPI.
- Includes an admin API (
/admin/files) for managing documents (upload/delete files with HTTP Basic Auth). - Serves static files for the frontend user interface.
Hugging Face Spaces Ready:
- Contains configuration (
Dockerfile, YAML frontmatter) for seamless deployment on Hugging Face Spaces. - Intelligent data handling: Uses
/datapersistent storage on HF Spaces while defaulting to a localdatafolder during local development.
- Contains configuration (
ποΈ Project Architecture
app.py: The main entry point for the FastAPI server. Features the/askendpoint (for RAG/Agent/Chat), document processing, initialization of the vector store, translation wrappers, and admin routes.mistral.py: A standalone alternative or legacy iteration emphasizing the Mistral-based RAG logic without full agent integration.nps_agent.py: Contains the logic for the Autonomous Browser Agent, communicating with a local Ollama instance to perform multi-step web navigation tasks.STARTUP.md: A step-by-step guide to setting up and running the application, including environment setup and starting local servers.AGENTS.md: Instructions and behavioral guidelines governing the browsing agent's deep-research flow./data: Directory storing the knowledge base files./frontend: Contains the static web files (HTML, CSS, JS) forming the UI.
π Getting Started
If you want to run this project locally, follow the detailed setup guide in STARTUP.md.
Here's the quick summary:
- Clone & Env Setup:
Ensure you have a
.envfile containing yourMISTRAL_API_KEY,ADMIN_USERNAME, andADMIN_PASSWORD. - Install Requirements:
pip install -r requirements.txt playwright install - Start Ollama (for the Agent):
ollama serve ollama pull kimi-k2.5:cloud - Run the Application:
Access the Web UI at http://localhost:7860.python app.py
π How to Use
- Chatbot: Submit queries via the Web UI. If you ask about details contained in the
/datafolder, the bot will synthesize an answer and cite the source pages. - Agent Mode: Select "agent" mode or send a request to
/agent/runwith a specifictask(e.g., "Find the latest news about AI"). The backend invokes the browser agent to complete the task and return the result. - Document Management: Use the secure endpoints under
/adminto upload or delete PDFs dynamically without restarting the server.
π οΈ Configuration Details
Hugging Face Spaces config blocks the top of this README.md.
For full configuration parameters, check https://huggingface.co/docs/hub/spaces-config-reference