# Deployment Instructions This document provides instructions for deploying the chatbot application with Ollama and OpenWebUI integration. ## Prerequisites - Python 3.8 or higher - pip - virtualenv or venv - Access to OpenWebUI at http://104.225.217.215:8080 ## Deployment Steps 1. **Clone the repository** ```bash git clone cd ``` 2. **Create and activate a virtual environment** ```bash python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate ``` 3. **Install dependencies** ```bash pip install -r requirements.txt pip install python-dotenv langchain-text-splitters ``` 4. **Create a .env file** Copy the .env.example file to .env and update the values: ```bash cp ai_service/.env.example ai_service/.env # Edit the .env file with appropriate values ``` Make sure to include the OpenWebUI configuration: ``` # OpenWebUI configuration OPENWEBUI_URL=http://104.225.217.215:8080 OPENWEBUI_API_KEY=GdCU4ieYDqHsLfH2 # Ollama configuration OLLAMA_API_URL=http://104.225.217.215:8080/ollama DEFAULT_MODEL=llama3.1 ``` 5. **Run the deployment script** For local deployment: ```bash python -m ai_service.run ``` For server deployment: ```bash ./ai_service/deploy.sh ``` This will start the application on port 5251 using uvicorn with nohup. For remote deployment from your local machine: ```bash ./remote_deploy.sh 157.157.221.29 user 22 /home/user/ds_zagres_ai ``` 6. **Verify the application is running** ```bash curl http://localhost:5251/api/health ``` You should see a response like: ```json { "status": "healthy" } ``` ## Managing the Deployed Application - **View logs** ```bash tail -f app.log ``` - **Stop the application** ```bash ps aux | grep uvicorn # Find the process ID (PID) kill # Replace with the actual process ID ``` - **Restart the application** ```bash ./deploy.sh ``` ## API Endpoints - `GET /health` - Health check endpoint - `POST /chats` - Create a new chat - `POST /chats/{chat_id}/messages` - Send a message to the chatbot - `GET /chats/{chat_id}` - Get chat history ## Ollama and OpenWebUI Integration The chatbot now uses Ollama models via OpenWebUI. The following models are available: - **gemma3**: Google Gemma 3 model - **llama3.3**: Meta Llama 3 70B model - **llama3.1**: Meta Llama 3 8B model - **mistral**: Mistral AI model - **deepseek**: DeepSeek model ### Document Training To use RAG with your documents: 1. Go to the OpenWebUI interface at http://104.225.217.215:8080/ 2. Navigate to the Knowledge section 3. Upload your documents 4. OpenWebUI will automatically process them for RAG When using the chatbot API, set `use_rag=True` in your chat requests to enable RAG.