Spaces:
Sleeping
Sleeping
|
Download STARTUP.md from YADUUG/NPS-ChatAgentBot: direct link, hf CLI and curl.
- Browser
- Download file 2.11 kB
-
https://huggingface.co/spaces/YADUUG/NPS-ChatAgentBot/resolve/main/STARTUP.md
- Command line
-
hf download hf://spaces/YADUUG/NPS-ChatAgentBot/STARTUP.md
-
curl -L -o STARTUP.md https://huggingface.co/spaces/YADUUG/NPS-ChatAgentBot/resolve/main/STARTUP.md
2.11 kB
| # Startup Instructions for NPS-AI | |
| This guide explains how to set up and run the NPS-AI project, including the FastAPI chatbot and the autonomous browser agent. | |
| ## Prerequisites | |
| - **Python 3.10+** | |
| - **Ollama** (for local agent inference) | |
| - **Mistral API Key** (for chatbot RAG) | |
| ## 1. Environment Setup | |
| 1. **Clone the repository** (if not already done). | |
| 2. **Create a `.env` file** in the project root: | |
| ```bash | |
| cp .env.example .env # If .env.example exists | |
| # OR create manually: | |
| touch .env | |
| ``` | |
| 3. **Configure Environment Variables** in `.env`: | |
| ```ini | |
| MISTRAL_API_KEY=your_mistral_api_key_here | |
| # Optional Admin Credentials for file management | |
| ADMIN_USERNAME=admin | |
| ADMIN_PASSWORD=admin | |
| ``` | |
| ## 2. Install Dependencies | |
| Install the required Python packages: | |
| ```bash | |
| pip install -r requirements.txt | |
| ``` | |
| Verify that `playwright` browsers are installed (required for the agent): | |
| ```bash | |
| playwright install | |
| ``` | |
| ## 3. Ollama Setup (For Agent) | |
| The agent uses a local Ollama model (`kimi-k2.5:cloud` by default in `nps_agent.py`). Ensure Ollama is running and the model is pulled: | |
| 1. **Start Ollama**: | |
| ```bash | |
| ollama serve | |
| ``` | |
| 2. **Pull the Model**: | |
| ```bash | |
| ollama pull kimi-k2.5:cloud | |
| ``` | |
| *(Note: If you use a different model, update `model_name` in `nps_agent.py`)* | |
| ## 4. Running the Application | |
| ### Option A: Run the Full Application (Chatbot + Agent API) | |
| Start the FastAPI server: | |
| ```bash | |
| python app.py | |
| ``` | |
| - **URL**: `http://localhost:7860` | |
| - **Chatbot Interface**: Accessible at the root URL (configured via static files in `frontend`). | |
| - **Agent Endpoint**: `POST /agent/run` | |
| ### Option B: Run the Agent Standalone | |
| To test the agent directly specifically: | |
| ```bash | |
| python nps_agent.py | |
| ``` | |
| *(This will prompt for a task input in the terminal)* | |
| ## Troubleshooting | |
| - **Import Errors**: Ensure you are in the virtual environment (`source .venv/bin/activate` or similar). | |
| - **Browser Issues**: Run `playwright install` again. | |
| - **LLM Connection**: Check if Ollama is running on port 11434 (`http://localhost:11434`). | |