mirror of
https://github.com/katanemo/plano.git
synced 2026-05-01 11:56:29 +02:00
run demos without docker, keep docker optional via --with-ui
This commit is contained in:
parent
b9f01c8471
commit
1285bd083d
33 changed files with 447 additions and 316 deletions
|
|
@ -7,7 +7,14 @@ This demo shows how you can use Plano gateway to manage keys and route to upstre
|
|||
```sh
|
||||
sh run_demo.sh
|
||||
```
|
||||
1. Navigate to http://localhost:3001/
|
||||
1. Test with curl (see example below)
|
||||
|
||||
To also start the AnythingLLM chat UI and Jaeger tracing, pass `--with-ui`:
|
||||
```sh
|
||||
sh run_demo.sh --with-ui
|
||||
```
|
||||
|
||||
Then navigate to http://localhost:3001/ for AnythingLLM.
|
||||
|
||||
Following screen shows an example of interaction with Plano gateway showing dynamic routing. You can select between different LLMs using "override model" option in the chat UI.
|
||||
|
||||
|
|
@ -47,7 +54,7 @@ $ curl --header 'Content-Type: application/json' \
|
|||
```
|
||||
|
||||
# Observability
|
||||
For tracing you can head over to http://localhost:16686/ to view recent traces.
|
||||
For tracing, start with `--with-ui` and head over to http://localhost:16686/ to view recent traces.
|
||||
|
||||
Following is a screenshot of tracing UI showing call received by Plano gateway and making upstream call to LLM,
|
||||
|
||||
|
|
|
|||
|
|
@ -22,18 +22,19 @@ start_demo() {
|
|||
echo "Starting Plano with config.yaml..."
|
||||
planoai up config.yaml
|
||||
|
||||
# Step 4: Start LLM Routing
|
||||
echo "Starting LLM Routing using Docker Compose..."
|
||||
docker compose up -d # Run in detached mode
|
||||
# Step 4: Optionally start UI services (AnythingLLM, Jaeger)
|
||||
if [ "$1" == "--with-ui" ]; then
|
||||
echo "Starting UI services (AnythingLLM, Jaeger)..."
|
||||
docker compose up -d
|
||||
fi
|
||||
}
|
||||
|
||||
# Function to stop the demo
|
||||
stop_demo() {
|
||||
# Step 1: Stop Docker Compose services
|
||||
echo "Stopping LLM Routing using Docker Compose..."
|
||||
docker compose down
|
||||
# Stop Docker Compose services if running
|
||||
docker compose down 2>/dev/null || true
|
||||
|
||||
# Step 2: Stop Plano
|
||||
# Stop Plano
|
||||
echo "Stopping Plano..."
|
||||
planoai down
|
||||
}
|
||||
|
|
@ -42,6 +43,5 @@ stop_demo() {
|
|||
if [ "$1" == "down" ]; then
|
||||
stop_demo
|
||||
else
|
||||
# Default action is to bring the demo up
|
||||
start_demo
|
||||
start_demo "$1"
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -10,15 +10,26 @@ This demo shows how you can use Plano's core function calling capabilities.
|
|||
3. ```sh
|
||||
sh run_demo.sh
|
||||
```
|
||||
4. Navigate to http://localhost:3001/
|
||||
5. You can type in queries like "how is the weather?"
|
||||
4. Test with curl:
|
||||
```sh
|
||||
curl http://localhost:10000/v1/chat/completions \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{"model": "gpt-4o", "messages": [{"role": "user", "content": "how is the weather in San Francisco?"}]}'
|
||||
```
|
||||
|
||||
Here is a sample interaction,
|
||||
<img width="575" alt="image" src="https://github.com/user-attachments/assets/e0929490-3eb2-4130-ae87-a732aea4d059">
|
||||
|
||||
## Tracing
|
||||
## Using the Chat UI and Tracing (optional)
|
||||
|
||||
To see a tracing dashboard, navigate to http://localhost:16686/ to open Jaeger UI.
|
||||
To start AnythingLLM (chat UI) and other optional services, pass `--with-ui`:
|
||||
|
||||
```sh
|
||||
sh run_demo.sh --with-ui
|
||||
```
|
||||
|
||||
- Navigate to http://localhost:3001/ for AnythingLLM
|
||||
- Navigate to http://localhost:16686/ for Jaeger tracing UI
|
||||
|
||||
### Stopping Demo
|
||||
|
||||
|
|
|
|||
|
|
@ -1,14 +1,4 @@
|
|||
services:
|
||||
weather_forecast_service:
|
||||
build:
|
||||
context: ./
|
||||
environment:
|
||||
- OLTP_HOST=http://jaeger:4317
|
||||
extra_hosts:
|
||||
- "host.docker.internal:host-gateway"
|
||||
ports:
|
||||
- "18083:80"
|
||||
|
||||
anythingllm:
|
||||
image: mintplexlabs/anythingllm
|
||||
restart: always
|
||||
|
|
|
|||
|
|
@ -76,19 +76,27 @@ start_demo() {
|
|||
echo "Starting Plano with config.yaml..."
|
||||
planoai up config.yaml
|
||||
|
||||
# Step 5: Start Network Agent with the chosen Docker Compose file
|
||||
echo "Starting Network Agent with $COMPOSE_FILE..."
|
||||
docker compose -f "$COMPOSE_FILE" up -d # Run in detached mode
|
||||
# Step 5: Start agents natively
|
||||
echo "Starting agents..."
|
||||
bash start_agents.sh &
|
||||
|
||||
# Step 6: Optionally start UI services (AnythingLLM, Jaeger, etc.)
|
||||
if [ "$1" == "--with-ui" ] || [ "$2" == "--with-ui" ]; then
|
||||
echo "Starting UI services with $COMPOSE_FILE..."
|
||||
docker compose -f "$COMPOSE_FILE" up -d
|
||||
fi
|
||||
}
|
||||
|
||||
# Function to stop the demo
|
||||
stop_demo() {
|
||||
echo "Stopping all Docker Compose services..."
|
||||
# Stop agents
|
||||
echo "Stopping agents..."
|
||||
pkill -f start_agents.sh 2>/dev/null || true
|
||||
|
||||
# Stop all services by iterating through all configurations
|
||||
# Stop all Docker Compose services if running
|
||||
echo "Stopping Docker Compose services..."
|
||||
for compose_file in ./docker-compose*.yaml; do
|
||||
echo "Stopping services in $compose_file..."
|
||||
docker compose -f "$compose_file" down
|
||||
docker compose -f "$compose_file" down 2>/dev/null || true
|
||||
done
|
||||
|
||||
# Stop Plano
|
||||
|
|
@ -101,6 +109,6 @@ if [ "$1" == "down" ]; then
|
|||
# Call stop_demo with the second argument as the demo to stop
|
||||
stop_demo
|
||||
else
|
||||
# Use the argument (jaeger, logfire, signoz) to determine the compose file
|
||||
start_demo "$1"
|
||||
# Use the argument (jaeger, logfire, signoz, --with-ui) to determine the compose file
|
||||
start_demo "$1" "$2"
|
||||
fi
|
||||
|
|
|
|||
24
demos/getting_started/weather_forecast/start_agents.sh
Executable file
24
demos/getting_started/weather_forecast/start_agents.sh
Executable file
|
|
@ -0,0 +1,24 @@
|
|||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
PIDS=()
|
||||
|
||||
log() { echo "$(date '+%F %T') - $*"; }
|
||||
|
||||
cleanup() {
|
||||
log "Stopping agents..."
|
||||
for PID in "${PIDS[@]}"; do
|
||||
kill $PID 2>/dev/null && log "Stopped process $PID"
|
||||
done
|
||||
exit 0
|
||||
}
|
||||
|
||||
trap cleanup EXIT INT TERM
|
||||
|
||||
log "Starting weather_forecast_service on port 18083..."
|
||||
uv run uvicorn main:app --host 0.0.0.0 --port 18083 &
|
||||
PIDS+=($!)
|
||||
|
||||
for PID in "${PIDS[@]}"; do
|
||||
wait "$PID"
|
||||
done
|
||||
Loading…
Add table
Add a link
Reference in a new issue