|
9 | 9 | * file that was distributed with this source code.
|
10 | 10 | */
|
11 | 11 |
|
12 |
| -use PhpLlm\LlmChain\Chain\Chain; |
13 |
| -use PhpLlm\LlmChain\Chain\Toolbox\ChainProcessor; |
14 |
| -use PhpLlm\LlmChain\Chain\Toolbox\Tool\Clock; |
15 |
| -use PhpLlm\LlmChain\Chain\Toolbox\Toolbox; |
16 |
| -use PhpLlm\LlmChain\Platform\Bridge\Google\Gemini; |
17 |
| -use PhpLlm\LlmChain\Platform\Bridge\Google\PlatformFactory; |
18 |
| -use PhpLlm\LlmChain\Platform\Message\Message; |
19 |
| -use PhpLlm\LlmChain\Platform\Message\MessageBag; |
| 12 | +use Symfony\AI\Agent\Agent; |
| 13 | +use Symfony\AI\Agent\Toolbox\AgentProcessor; |
| 14 | +use Symfony\AI\Agent\Toolbox\Tool\Clock; |
| 15 | +use Symfony\AI\Agent\Toolbox\Toolbox; |
| 16 | +use Symfony\AI\Platform\Bridge\Google\Gemini; |
| 17 | +use Symfony\AI\Platform\Bridge\Google\PlatformFactory; |
| 18 | +use Symfony\AI\Platform\Message\Message; |
| 19 | +use Symfony\AI\Platform\Message\MessageBag; |
20 | 20 | use Symfony\Component\Dotenv\Dotenv;
|
21 | 21 |
|
22 |
| -require_once dirname(__DIR__, 2).'/vendor/autoload.php'; |
23 |
| -(new Dotenv())->loadEnv(dirname(__DIR__, 2).'/.env'); |
| 22 | +require_once dirname(__DIR__).'/vendor/autoload.php'; |
| 23 | +(new Dotenv())->loadEnv(dirname(__DIR__).'/.env'); |
24 | 24 |
|
25 | 25 | if (!isset($_ENV['GEMINI_API_KEY'])) {
|
26 | 26 | echo 'Please set the GEMINI_API_KEY environment variable.'.\PHP_EOL;
|
|
33 | 33 | $llm = new Gemini('gemini-2.5-pro-preview-03-25', ['server_tools' => ['url_context' => true], 'temperature' => 1.0]);
|
34 | 34 |
|
35 | 35 | $toolbox = Toolbox::create(new Clock());
|
36 |
| -$processor = new ChainProcessor($toolbox); |
37 |
| -$chain = new Chain($platform, $llm); |
| 36 | +$processor = new AgentProcessor($toolbox); |
| 37 | +$agent = new Agent($platform, $llm); |
38 | 38 |
|
39 | 39 | $messages = new MessageBag(
|
40 | 40 | Message::ofUser(
|
|
44 | 44 | ),
|
45 | 45 | );
|
46 | 46 |
|
47 |
| -$response = $chain->call($messages); |
| 47 | +$response = $agent->call($messages); |
48 | 48 |
|
49 | 49 | echo $response->getContent().\PHP_EOL;
|
0 commit comments