Skip to content

Enhance RAG API to return token usage information and improve error h… #14

Enhance RAG API to return token usage information and improve error h…

Enhance RAG API to return token usage information and improve error h… #14

Workflow file for this run

name: CI Build
on:
push:
branches: [ main ]
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build with Docker Compose
run: |
docker compose build
- name: Verify builds completed
run: |
echo "✅ Docker Compose build completed successfully"
docker images | grep memoryalpha-rag-api
- name: Test health endpoint readiness
run: |
# Start services in background
docker compose up -d
# Wait for services to be ready (max 5 minutes)
timeout 300 bash -c 'until curl -f http://localhost:8000/memoryalpha/health > /dev/null 2>&1; do sleep 5; echo "Waiting for API..."; done'
# Verify health endpoint
curl -f http://localhost:8000/memoryalpha/health
echo "✅ Health check passed"
- name: Test ask endpoint
run: |
# Test the ask endpoint with a simple query
response=$(curl -X POST "http://localhost:8000/memoryalpha/rag/ask" -H "Content-Type: application/json" -d '{
"question": "What is the color of Vulcan blood?"
}')
# Check if response contains expected content
if echo "$response" | grep -q "green"; then
echo "✅ Ask endpoint test passed"
else
echo "❌ Ask endpoint test failed, answer did not contain expected content"
echo "Response: $response"
exit 1
fi
- name: Generate OpenAPI spec
run: |
# Download OpenAPI spec
curl -s http://localhost:8000/openapi.json -o memoryalpha-rag-api-spec.json
cat memoryalpha-rag-api-spec.json
- name: Cleanup
if: always()
run: |
docker compose down -v
docker system prune -f