aiagent / DEPLOYMENT.md
jdewitte's picture
First deployment of complete llm
e02dee9
|
Raw
History Blame Contribute Delete
3.33 kB

🧠 Hugging Face Inference Endpoint - Ready for Deplo2. Set app_port: 7860 in README.md headerment

βœ… What's Been Created

The inference_point directory now contains a complete lightweight LLM inference endpoint that:

  • 🎯 Standard HF API: Provides Hugging Face-compatible REST API on port 8000
  • πŸ”Œ MCP Integration: Can connect to external MCP servers for enhanced capabilities
  • 🐳 Docker Ready: Fully containerized for Hugging Face Spaces deployment
  • ⚑ Lightweight: Minimal dependencies for fast startup and inference

πŸš€ Quick Start

Local Testing

cd inference_point
python app.py
# API available at http://localhost:7860

Standard HF API Usage

# Basic inference
curl -X POST http://localhost:7860/ \
  -H "Content-Type: application/json" \
  -d '{"inputs": "Hello world"}'

# With parameters
curl -X POST http://localhost:7860/ \
  -H "Content-Type: application/json" \
  -d '{
    "inputs": "Tell me about product 123",
    "parameters": {
      "max_new_tokens": 150,
      "mcp_server_url": "https://your-mcp-server.hf.space"
    }
  }'

πŸ“ Files Created

  • app.py - Main FastAPI application with HF-compatible endpoints
  • Dockerfile - Container configuration for HF Spaces
  • requirements.txt - Lightweight dependencies (FastAPI, httpx, uvicorn)
  • README.md - Comprehensive documentation for HF Spaces
  • start.sh - Startup script with health checks
  • test_api.sh - Complete API testing script
  • .env.example - Environment configuration template

🌐 Deployment Options

1. Hugging Face Spaces

  1. Create new Space with Docker SDK
  2. Upload all files from inference_point/
  3. Set app_port: 8000 in README.md header
  4. Configure MCP_SERVER_URL environment variable

2. Hugging Face Inference Endpoints

  1. Use this Docker setup for custom inference endpoints
  2. Configure auto-scaling and instance types
  3. Set environment variables for MCP integration

πŸ”— Architecture

HTTP Request β†’ Lightweight LLM β†’ [Optional MCP Server] β†’ HF-Compatible Response

Key Features:

  • Auto-detection: Automatically detects when to use MCP tools based on keywords
  • Fallback: Works perfectly without MCP server (direct responses)
  • Configurable: Can connect to different MCP servers per request
  • Standard Format: Returns responses in standard Hugging Face format

πŸ“Š API Endpoints

  • POST / - Main inference endpoint (HF compatible)
  • GET /health - Health check and MCP status
  • GET /info - Model and service information
  • GET / - API information and usage examples

🎯 Next Steps

  1. Deploy to HF Spaces: Upload to new Docker-based Space
  2. Connect MCP Server: Set MCP_SERVER_URL to your MCP server Space
  3. Scale as Needed: Use HF Inference Endpoints for production loads
  4. Integrate: Use standard HF API calls from your applications

✨ Hugging Face Compliant

The inference endpoint is now fully HF compliant using port 7860 (HF standard) and can be deployed immediately to Hugging Face Spaces or Inference Endpoints. It provides a clean separation between the lightweight LLM inference and the MCP server, allowing independent scaling and deployment.


πŸš€ Lightweight, Fast, and HF-Compatible!