mirror of
https://github.com/symfony/ai.git
synced 2026-03-23 23:42:18 +01:00
25 lines
922 B
PHP
25 lines
922 B
PHP
<?php
|
|
|
|
/*
|
|
* This file is part of the Symfony package.
|
|
*
|
|
* (c) Fabien Potencier <fabien@symfony.com>
|
|
*
|
|
* For the full copyright and license information, please view the LICENSE
|
|
* file that was distributed with this source code.
|
|
*/
|
|
|
|
use Symfony\AI\Platform\Bridge\Ollama\PlatformFactory;
|
|
|
|
require_once dirname(__DIR__).'/bootstrap.php';
|
|
|
|
$platform = PlatformFactory::create(env('OLLAMA_HOST_URL'), env('OLLAMA_API_KEY'), httpClient: http_client());
|
|
|
|
$response = $platform->invoke(env('OLLAMA_EMBEDDINGS'), <<<TEXT
|
|
Once upon a time, there was a country called Japan. It was a beautiful country with a lot of mountains and rivers.
|
|
The people of Japan were very kind and hardworking. They loved their country very much and took care of it. The
|
|
country was very peaceful and prosperous. The people lived happily ever after.
|
|
TEXT);
|
|
|
|
echo 'Dimensions: '.$response->asVectors()[0]->getDimensions().\PHP_EOL;
|