symfony / ai-open-router-platform
OpenRouter platform bridge for Symfony AI
Package info
github.com/symfony/ai-open-router-platform
Type:symfony-ai-platform
pkg:composer/symfony/ai-open-router-platform
Requires
- php: >=8.2
- symfony/ai-generic-platform: ^1.0
- symfony/ai-platform: ^1.0
- symfony/http-client: ^7.3|^8.0
Requires (Dev)
- phpstan/phpstan: ^2.1
- phpstan/phpstan-phpunit: ^2.0
- phpstan/phpstan-strict-rules: ^2.0
- phpunit/phpunit: ^11.5.53
- symfony/console: ^7.4|^8.0
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
OpenRouter platform bridge for Symfony AI.
Decision models
Decision models are served through the experimental POST /api/alpha/decisions endpoint.
This requires symfony/ai-decision-platform. They are queried with the Evaluation of the
Decision bridge and answer with its Answers. Use the DecisionModelCatalog or the
ModelApiCatalog, which lists them via GET /v1/models?output_modalities=decisions.
use Symfony\AI\Platform\Bridge\Decision\Evaluation; use Symfony\AI\Platform\Bridge\Decision\Question\NoulQuestion; use Symfony\AI\Platform\Bridge\OpenRouter\Decision\DecisionModelCatalog; use Symfony\AI\Platform\Bridge\OpenRouter\Factory; $platform = Factory::createPlatform($apiKey, modelCatalog: new DecisionModelCatalog()); $answers = $platform->invoke('typesafe/jev-1.13', new Evaluation($ticket, [ 'is_bug' => new NoulQuestion('Is this a software defect?', 'Broken behavior', 'A question or feature request'), ]))->asObject();
When a NoulQuestion has criteria, OpenRouter requires both the true and the false one. The
provider, session_id, trace and user options are forwarded to the request. Image inputs and
box questions are not supported yet.