openai-php / client

⚡️ OpenAI PHP is a supercharged community-maintained PHP API client that allows you to interact with OpenAI API.
MIT License
4.57k stars 466 forks source link

fix: handle `x-request-id` in `MetaInformation` #283

Closed olegnowikow closed 7 months ago

olegnowikow commented 7 months ago

What:

Description:

Fix handle of the x-request-id header when using models that do not return it:

<?php

namespace App\Service;

use OpenAI;

final class Ai
{
    private $client;

    public function __construct()
    {
        $this->client = OpenAI::factory()
            ->withBaseUri('http://localhost:8888/v1')
            ->make();
    }

    public function getModels()
    {
        return $this->client->models()->list();
    }
}

image

Related:

253

gehrisandro commented 7 months ago

Thans @olegnowikow for your PR!