symfony/ai-amazee-ai-platform
Symfony AI bridge for the amazee.ai Platform. Connect Symfony AI to LiteLLM proxy endpoints and OpenAI-compatible providers through amazee.ai, enabling centralized AI access and management. Links to docs, issues, and contributions in the main Symfony AI repo.
ClientInterface, Provider abstraction, and DeltaInterface for type-safe streaming. This aligns seamlessly with Symfony’s AI bundle, enabling provider-agnostic AI orchestration with minimal boilerplate. The model routing layer (v0.8.0) introduces a declarative approach to dynamic model selection, which is ideal for Symfony’s dependency injection and configuration-driven workflows.Illuminate\Contracts\Container\Container lacks Symfony’s ProviderInterface and ClientInterface support.AiEvent system may not integrate cleanly without custom middleware or event listeners in Laravel.amazee.ai proxy routes requests dynamically).gpt-4 → mistral-7b) reduces expenses without code changes.DeltaInterface replaces raw JSON chunks, improving type safety for real-time applications (e.g., chatbots).symfony/ai bundle. Requires:
symfony/ai-amazeeai-platform.config/packages/symfony_ai.yaml:
symfony_ai:
providers:
amazee_ai:
client: amazee.ai
key: "%env(AMAZEE_AI_KEY)%"
routing:
default: gpt-3.5-turbo
fallback: mistral-7b
Client in a Laravel service provider or facade..env and config/amazee_ai.php must mirror Symfony’s YAML structure.DeltaInterface.HttpClient within Laravel for API calls (avoids full bundle integration).Client:
// app/Facades/AmazeeAi.php
public static function chat(string $model, array $messages): array
{
return app('amazee.ai.client')->chat($model, $messages);
}
DeltaInterface improves streaming, non-streaming responses may lack Laravel’s native type safety (e.g., return type hints).ClientInterface and Provider abstractions integrate seamlessly.AiEvent system enables extensibility (e.g., logging, monitoring).symfony/ai bundle.HttpClient for API calls (if not using the bundle).bind() or service providers to register Symfony’s Client..env and config/amazee_ai.php.DeltaInterface.HttpClient (via symfony/http-client package).Client abstraction.composer require symfony/ai-amazeeai-platform
# config/packages/symfony_ai.yaml
symfony_ai:
providers:
amazee_ai:
client: amazee.ai
key: "%env(AMAZEE_AI_KEY)%"
ClientInterface:
use Symfony\AI\Client;
public function __construct(private Client $client) {}
symfony_ai:
providers:
amazee_ai:
routing:
default: gpt-3.5-turbo
fallback: mistral-7b
cost_threshold: 0.5
HttpClient and package:
composer require symfony/http-client symfony/ai-amazeeai-platform
// app/Providers/AmazeeAiServiceProvider.php
public function register()
{
$this->app->singleton('amazee.ai.client', function ($app) {
return new \Symfony\AI\Client(
new \Symfony\AI\Provider\AmazeeAiProvider(
$app['config']['amazee_ai.key']
)
);
});
}
// app/Facades/AmazeeAi.php
public static function chat(string $model, array $messages): array
{
return app('amazee.ai.client')->chat($model, $messages);
}
DeltaInterface.How can I help you explore Laravel packages today?