- CustomToolRouter como callback (roda em todas as chamadas) - ToolRouterGuardrail para ativação por request - Modos: jaccard (offline) e embedding (API) - Dockerfile + docker-compose prontos - README com docs completas - Teste offline validando ~74% redução de tokens
38 lines
1.2 KiB
YAML
38 lines
1.2 KiB
YAML
services:
|
|
litellm:
|
|
build: .
|
|
image: tool-router-litellm:latest
|
|
container_name: tool-router-litellm
|
|
ports:
|
|
- "${PORT:-4000}:4000"
|
|
env_file:
|
|
- .env
|
|
environment:
|
|
# Garante import do tool_router_logger
|
|
PYTHONPATH: /app
|
|
# Defaults do router (sobrescreva no .env se quiser)
|
|
TOOL_ROUTER_SIMILARITY_MODE: ${TOOL_ROUTER_SIMILARITY_MODE:-jaccard}
|
|
TOOL_ROUTER_TOP_K: ${TOOL_ROUTER_TOP_K:-3}
|
|
TOOL_ROUTER_MIN_SIMILARITY: ${TOOL_ROUTER_MIN_SIMILARITY:-0.15}
|
|
TOOL_ROUTER_ALWAYS_INCLUDE: ${TOOL_ROUTER_ALWAYS_INCLUDE:-get_time,help,list_tools}
|
|
TOOL_ROUTER_EMBEDDING_MODEL: ${TOOL_ROUTER_EMBEDDING_MODEL:-text-embedding-3-small}
|
|
volumes:
|
|
# Permite editar config sem rebuild
|
|
- ./config.yaml:/app/config.yaml:ro
|
|
- ./tool_router_logger.py:/app/tool_router_logger.py:ro
|
|
restart: unless-stopped
|
|
healthcheck:
|
|
test: ["CMD", "curl", "-fsS", "http://127.0.0.1:4000/health"]
|
|
interval: 30s
|
|
timeout: 5s
|
|
retries: 3
|
|
start_period: 20s
|
|
|
|
# Opcional: descomente se for usar cache semântico Valkey no config.yaml
|
|
# valkey:
|
|
# image: valkey/valkey:8-alpine
|
|
# container_name: tool-router-valkey
|
|
# ports:
|
|
# - "6379:6379"
|
|
# restart: unless-stopped
|