<?php
require 'examples/boot.php';
use Cognesy\Polyglot\Inference\Inference;
use Cognesy\Polyglot\Inference\InferenceRuntime;
use Cognesy\Http\Creation\HttpClientBuilder;
use Cognesy\Polyglot\Inference\Config\LLMConfig;
$http = (new HttpClientBuilder())->withDebugConfig(ExampleConfig::debugPreset('on'))->create();
$response = Inference::fromRuntime(InferenceRuntime::fromConfig(
config: ExampleConfig::llmPreset('openai'),
httpClient: $http,
))
->with(
messages: [['role' => 'user', 'content' => 'What is the capital of Brasil']],
options: ['max_tokens' => 128]
)
->get();
echo "USER: What is capital of Brasil\n";
echo "ASSISTANT: $response\n";
?>