openai-php / client

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

[Bug]: Each element of the header is in array format #331

Closed rkgo55 closed 4 months ago

rkgo55 commented 4 months ago

Description

Thank you for all your help It may need to be modified as follows

# https://github.com/openai-php/client/blob/f6b47acbe326851a790d158a56e6bedb4e533f67/src/Testing/Responses/Concerns/Fakeable.php#L50
    public static function fakeResponseMetaInformation(): MetaInformation
    {
        return MetaInformation::from([
            'openai-model' => ['gpt-3.5-turbo-instruct'],
            'openai-organization' => ['org-1234'],
            'openai-processing-ms' => ['410'],
            'openai-version' => ['2020-10-01'],
            'x-ratelimit-limit-requests' => ['3000'],
            'x-ratelimit-limit-tokens' => ['250000'],
            'x-ratelimit-remaining-requests' => ['2999'],
            'x-ratelimit-remaining-tokens' => ['249989'],
            'x-ratelimit-reset-requests' => ['20ms'],
            'x-ratelimit-reset-tokens' => ['2ms'],
            'x-request-id' => ['3813fa4fa3f17bdf0d7654f0f49ebab4'],
        ]);
    }

Steps To Reproduce

    $meta = (new ClientFake([CreateResponse::fake()]))->chat()->create([
        'messages' => [
            ['role' => 'system', 'content' => 'hello'],
        ],
    ])->meta();
    dump($meta);

OpenAI PHP Client Version

0.8.0

PHP Version

8.1.13

Notes

No response

rkgo55 commented 4 months ago

Thank you!