<?php
namespace App\AI\SymfonyAiExtend\Agent; use App\AI\SymfonyAiExtend\Gemini\InteractionsFactory as GeminiInteractionsFactory; use App\AI\SymfonyAiExtend\Processor\DatabaseProcessor; use App\AI\SymfonyAiExtend\Processor\GeminiMainInputProcessor; use Symfony\AI\Agent\Agent; use App\AI\SymfonyAiExtend\Gemini\ModelCatalog as GeminiModelCatalog; class GeminiMainAgentFactory implements MainAgentFactoryInterface { public function __construct( private readonly string $model, private readonly string $apiKey, private readonly MainAgentConfig $config, ) { } public function createMainAgent(int $idTopic, string $userMessage, array $useContexts): Agent { $platform = GeminiInteractionsFactory::createPlatform($this->apiKey, $this->config->traceable, GeminiModelCatalog::create()); $dbProcessor = new DatabaseProcessor($idTopic, $userMessage, 'main'); $geminiMainInputProcessor = new GeminiMainInputProcessor($this->config->contextManager, $idTopic, $userMessage, $useContexts); $inputProcessors = [ $geminiMainInputProcessor, $dbProcessor]; $outputProcessors = [ $dbProcessor, $this->config->mainOutputProcessor]; return new Agent($platform, $this->model, $inputProcessors, $outputProcessors, 'main'); } } 