2024-12-06 14:37:33 -08:00
|
|
|
#!/bin/bash
|
|
|
|
|
set -e
|
|
|
|
|
|
|
|
|
|
# Function to start the demo
|
|
|
|
|
start_demo() {
|
|
|
|
|
# Step 1: Check if .env file exists
|
|
|
|
|
if [ -f ".env" ]; then
|
|
|
|
|
echo ".env file already exists. Skipping creation."
|
|
|
|
|
else
|
2026-03-11 12:49:36 -07:00
|
|
|
# Step 2: Create `.env` file and set API keys
|
2024-12-06 14:37:33 -08:00
|
|
|
if [ -z "$OPENAI_API_KEY" ]; then
|
|
|
|
|
echo "Error: OPENAI_API_KEY environment variable is not set for the demo."
|
|
|
|
|
exit 1
|
|
|
|
|
fi
|
2026-03-11 12:49:36 -07:00
|
|
|
if [ -z "$ANTHROPIC_API_KEY" ]; then
|
|
|
|
|
echo "Warning: ANTHROPIC_API_KEY environment variable is not set. Anthropic features may not work."
|
|
|
|
|
fi
|
2024-12-06 14:37:33 -08:00
|
|
|
|
|
|
|
|
echo "Creating .env file..."
|
|
|
|
|
echo "OPENAI_API_KEY=$OPENAI_API_KEY" > .env
|
2026-03-11 12:49:36 -07:00
|
|
|
if [ -n "$ANTHROPIC_API_KEY" ]; then
|
|
|
|
|
echo "ANTHROPIC_API_KEY=$ANTHROPIC_API_KEY" >> .env
|
|
|
|
|
fi
|
|
|
|
|
echo ".env file created with API keys."
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
# Step 3: Optionally start UI services (AnythingLLM, Jaeger)
|
|
|
|
|
# Jaeger must start before Plano so it can bind the OTEL port (4317)
|
|
|
|
|
if [ "$1" == "--with-ui" ]; then
|
|
|
|
|
echo "Starting UI services (AnythingLLM, Jaeger)..."
|
|
|
|
|
docker compose up -d
|
2024-12-06 14:37:33 -08:00
|
|
|
fi
|
|
|
|
|
|
2026-03-11 12:49:36 -07:00
|
|
|
# Step 4: Start Plano
|
|
|
|
|
echo "Starting Plano with arch_config_with_aliases.yaml..."
|
|
|
|
|
planoai up arch_config_with_aliases.yaml
|
2024-12-06 14:37:33 -08:00
|
|
|
|
2026-03-11 12:49:36 -07:00
|
|
|
echo ""
|
|
|
|
|
echo "Plano started successfully."
|
|
|
|
|
echo "Please run the following CURL command to test model alias routing. Additional instructions are in the README.md file."
|
|
|
|
|
echo ""
|
|
|
|
|
echo "curl -sS -X POST \"http://localhost:12000/v1/chat/completions\" \
|
|
|
|
|
-H \"Authorization: Bearer test-key\" \
|
|
|
|
|
-H \"Content-Type: application/json\" \
|
|
|
|
|
-d '{
|
|
|
|
|
\"model\": \"arch.summarize.v1\",
|
|
|
|
|
\"max_tokens\": 50,
|
|
|
|
|
\"messages\": [
|
|
|
|
|
{ \"role\": \"user\",
|
|
|
|
|
\"content\": \"Hello, please respond with exactly: Hello from alias arch.summarize.v1!\"
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
}' | jq ."
|
2024-12-06 14:37:33 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
# Function to stop the demo
|
|
|
|
|
stop_demo() {
|
2026-03-11 12:49:36 -07:00
|
|
|
# Stop Docker Compose services if running
|
|
|
|
|
docker compose down 2>/dev/null || true
|
2024-12-06 14:37:33 -08:00
|
|
|
|
2026-03-11 12:49:36 -07:00
|
|
|
# Stop Plano
|
2026-01-28 17:47:33 -08:00
|
|
|
echo "Stopping Plano..."
|
2025-12-23 19:26:51 -08:00
|
|
|
planoai down
|
2024-12-06 14:37:33 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
# Main script logic
|
|
|
|
|
if [ "$1" == "down" ]; then
|
|
|
|
|
stop_demo
|
|
|
|
|
else
|
2026-03-11 12:49:36 -07:00
|
|
|
start_demo "$1"
|
2024-12-06 14:37:33 -08:00
|
|
|
fi
|