PHP code example of gtgt / symfony-ai-cursor-platform

1. Go to this page and download the library: Download gtgt/symfony-ai-cursor-platform library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

gtgt / symfony-ai-cursor-platform example snippets


use Symfony\AI\Agent\AgentInterface;
use Symfony\AI\Platform\Message\Message;
use Symfony\AI\Platform\Message\MessageBag;

final readonly class Assistant
{
    public function __construct(
        private AgentInterface $agent, // ai.agent.default
    ) {
    }

    public function ask(string $question): string
    {
        return $this->agent->call(new MessageBag(Message::ofUser($question)));
    }
}