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

[Bug]: transcribe 3 times and did not succeed #301

Closed chengxs1994 closed 6 months ago

chengxs1994 commented 6 months ago

Description

When I use larger audio files

Error: The cURL request was retried 3 times and did not succeed. The most likely reason for the failure is that cURL was unable to rewind the body of the request and subsequent retries resulted in the same error. Turn on the debug option to see what went wrong.

Steps To Reproduce

    $client = OpenAI::factory()
        ->withApiKey('sk-xxx')
        ->withBaseUri('one-api.xxx.com/v1')
        ->make();

    $response = $client->audio()->transcribe([
        'model' => 'whisper-1',
        'file' => fopen(base_path().'/test.wav', 'r'),
        'response_format' => 'verbose_json',
    ]);

OpenAI PHP Client Version

v0.7.10

PHP Version

8.1

Notes

No response

chengxs1994 commented 6 months ago

The problem I encountered in SWOOLE is that I can request it normally after opening--enable-swoole-curl

chengxs1994 commented 6 months ago

But when I use --enable-swoole-curl, the headers of the request response will become uppercase, and the logic in the code is to get lowercase, which will cause another error 有度即时通20231222143519

chengxs1994 commented 6 months ago

https://github.com/openai-php/client/pull/306

gehrisandro commented 6 months ago

swoole header should now work in the latest release v0.8.1