symfony/ai-gemini-platform
Symfony AI bridge for Google’s Gemini platform. Integrates Gemini generateContent (incl. streaming) and embeddings APIs, linking to official docs and API reference. Includes licensed media fixtures for tests and points to the main Symfony AI repo for issues/PRs.
ClientInterface and ModelClient without architectural conflicts, enabling seamless adoption.gemini-3.1-pro-preview to gemini-3-flash-preview), aligning with Laravel’s modular design. This reduces vendor lock-in and enables future-proofing for new Gemini models.batchEmbedContents) are a strong fit for Laravel applications requiring semantic search, document analysis, or AI-powered media processing. This complements Laravel’s ecosystem (e.g., Scout for search, Spatie’s AI tools).DeltaInterface) are ideal for Laravel’s real-time UX needs (e.g., chatbots, live analytics). Integration with Laravel Echo/Pusher or WebSockets is straightforward for handling chunked responses.ClientInterface and ModelClient via service providers, ensuring clean integration..env files can store Gemini API keys, and the package’s ClientInterface can be configured in config/services.php or via Laravel’s service providers.generateContent(), batchEmbedContents(), tool invocations) that mirrors Laravel’s Eloquent or Nova APIs, reducing the learning curve.RetryMiddleware and StreamingMiddleware can be adapted for Laravel’s HTTP client stack to handle retries and streaming responses.symfony/http-client, symfony/messenger) or polyfills if needed. Alternatively, upgrade Laravel to a supported version.gemini-3.1-pro-preview) may change or deprecate, requiring updates to the package or custom logic in Laravel.request()->file()) may need adaptation to work with Gemini’s MultiPartResult.Storage facade to preprocess media before sending to Gemini (e.g., convert uploaded files to base64 or stream them directly).gemini-3.1-pro-preview for accuracy or gemini-3-flash-preview for cost/performance)?ClientInterface and ModelClient without conflicts.AppServiceProvider or a dedicated GeminiServiceProvider to manage configuration and dependencies..env (e.g., GEMINI_API_KEY) and configure the client in config/services.php:
'gemini' => [
'api_key' => env('GEMINI_API_KEY'),
'default_model' => 'gemini-3.1-pro-preview',
'timeout' => 30,
],
HttpClient for consistency:
$client = new \Symfony\AI\Gemini\Client(
new \Symfony\Contracts\HttpClient\HttpClientInterface(
new \Symfony\Component\HttpClient\Psr18Client(
LaravelHttpClient::create()
)
)
);
$this->app->singleton(\Symfony\AI\Gemini\ClientInterface::class, function ($app) {
return new \Symfony\AI\Gemini\Client(
$app['http.client'],
$app['config']['gemini']
);
});
composer require symfony/ai-gemini-platform
config/services.php and bind it in a service provider.generateContent()) for chatbots or content creation.batchEmbedContents()) for search or recommendations.How can I help you explore Laravel packages today?