// Using custom HTTP client with proxy settings
use Cognesy\Http\Config\HttpClientConfig;
use Cognesy\Http\Creation\HttpClientBuilder;
use Cognesy\Polyglot\Inference\Inference;
use Cognesy\Polyglot\Inference\InferenceRuntime;
use GuzzleHttp\Client;
$config = new HttpClientConfig(
requestTimeout: 30,
connectTimeout: 10,
driver: 'guzzle',
);
$httpClient = (new HttpClientBuilder())
->withConfig($config)
->withClientInstance('guzzle', new Client([
'proxy' => 'http://proxy.example.com:8080',
]))
->create();
$inference = Inference::fromRuntime(InferenceRuntime::using(
preset: 'openai',
httpClient: $httpClient,
));
// @doctest id="4f08"