-
-
Notifications
You must be signed in to change notification settings - Fork 510
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug]: failed to upload files with Azure OpenAI #465
Comments
I've send this PR to |
@chris-lee-lb hi chris, i'm having the same exact issue, but i tried to remove the content-length code from /vendor/guzzlehttp/psr7/src/MultipartStream.php, but i still have the same issue
is there an alternative way to fix this issue ? thank you so much |
@mohammedhanafy Because we currently create custom function with use App\Support\MultipartStream;
use Illuminate\Support\Facades\Http;
$body = new MultipartStream($elements);
$boundary = $body->getBoundary();
$response = retry(
3,
fn () => Http::baseUrl($endpoint)
->withBody($body, "multipart/form-data; boundary={$boundary}")
->timeout($timeout)
->retry(3, 100, fn ($ex) => $ex instanceof ConnectionException)
->withHeaders(['api-key' => $apiKey])
->withQueryParameters(['api-version' => $apiVersion])
->send('post', '/files')
->throwUnlessStatus(201),
1000
); |
php-http/multipart-stream-builder#63 has been approved & released as |
Description
Currently can not upload files with Azure OpenAI successfully. Will receive this error messages.
Steps To Reproduce
OpenAI PHP Client Version
v0.10.1
PHP Version
8.3.10
Notes
After further root cause analysis, it was discovered that the issue was due to the Azure OpenAI API Server being unable to correctly parse the content-length in the multipart/form-data request body sent by the OpenAI HTTP client (came from this class -
Http\Message\MultipartStream\MultipartStreamBuilder
). Once this content-length is removed, the upload works as expected. Currently, there is a related pull request (guzzle/psr7#581) for the GuzzleHttp Client that is awaiting merge.The text was updated successfully, but these errors were encountered: