60 lines
1.9 KiB
Bash
60 lines
1.9 KiB
Bash
#!/bin/bash
|
|
# Test script for Local LLM Agent Gateway endpoints
|
|
# Usage: ./test-endpoints.sh [base_url]
|
|
|
|
BASE_URL="${1:-http://localhost:3160}"
|
|
|
|
echo "=============================================="
|
|
echo "Testing Local LLM Agent Gateway"
|
|
echo "Base URL: $BASE_URL"
|
|
echo "=============================================="
|
|
echo ""
|
|
|
|
# Test 1: Health check
|
|
echo "1. Testing GET /health"
|
|
echo "-------------------------------------------"
|
|
curl -s "$BASE_URL/health" | python -m json.tool 2>/dev/null || curl -s "$BASE_URL/health"
|
|
echo ""
|
|
echo ""
|
|
|
|
# Test 2: Liveness check
|
|
echo "2. Testing GET /health/live"
|
|
echo "-------------------------------------------"
|
|
curl -s "$BASE_URL/health/live" | python -m json.tool 2>/dev/null || curl -s "$BASE_URL/health/live"
|
|
echo ""
|
|
echo ""
|
|
|
|
# Test 3: Readiness check
|
|
echo "3. Testing GET /health/ready"
|
|
echo "-------------------------------------------"
|
|
curl -s "$BASE_URL/health/ready" | python -m json.tool 2>/dev/null || curl -s "$BASE_URL/health/ready"
|
|
echo ""
|
|
echo ""
|
|
|
|
# Test 4: List models
|
|
echo "4. Testing GET /v1/models"
|
|
echo "-------------------------------------------"
|
|
curl -s "$BASE_URL/v1/models" | python -m json.tool 2>/dev/null || curl -s "$BASE_URL/v1/models"
|
|
echo ""
|
|
echo ""
|
|
|
|
# Test 5: Chat completion (requires Inference Engine running)
|
|
echo "5. Testing POST /v1/chat/completions"
|
|
echo "-------------------------------------------"
|
|
curl -s -X POST "$BASE_URL/v1/chat/completions" \
|
|
-H "Content-Type: application/json" \
|
|
-d '{
|
|
"model": "gpt-oss-20b",
|
|
"messages": [
|
|
{"role": "user", "content": "Hello, respond with just \"Hi!\""}
|
|
],
|
|
"max_tokens": 50,
|
|
"temperature": 0.7
|
|
}' | python -m json.tool 2>/dev/null || echo "Chat completion requires Inference Engine + Ollama running"
|
|
echo ""
|
|
echo ""
|
|
|
|
echo "=============================================="
|
|
echo "Testing complete!"
|
|
echo "=============================================="
|