LemonAi. Application
(lemon_ai v0.1.0)
View Source
OTP Application for the AI module.
Supervision Tree
LemonAi.Supervisor(one_for_one)LemonAi.StreamTaskSupervisor- Dynamic supervisor for streaming tasksLemonAi.RateLimiterRegistry- Registry for per-provider rate limitersLemonAi.CircuitBreakerRegistry- Registry for per-provider circuit breakersLemonAi.CallDispatcher- Central dispatcher for request coordinationLemonAi.ProviderSupervisor- Dynamic supervisor for per-provider services
Design Decisions
ProviderRegistry: Uses
:persistent_terminstead of a GenServer for crash resilience. Providers survive process restarts without re-registration.StreamTaskSupervisor: A
Task.Supervisorthat manages all provider streaming tasks. This ensures proper lifecycle management and crash isolation.Rate Limiting & Circuit Breaking: Per-provider GenServers registered via
LemonAi.RateLimiterRegistryandLemonAi.CircuitBreakerRegistry. Started on-demand when providers are first used.
Summary
Functions
Register all built-in providers.