Closed TarikHusovicContentoo closed 12 months ago
Hi @TarikHusovicContentoo
Looks like OpenAI on Azure does not return the same headers as the standard API. I try to figure out what the differences are and how to tackle them. If you could provide a dump of all the HTTP-Headers returned, this would be helpful.
Meanwhile the only thing you can do is to downgrade to v0.6.X
@gehrisandro Hi, thanks for the response. Here are the headers from the completions endpoint over Azure:
`-headers: array:14 [
"cache-control" => array:1 [
0 => "no-cache, must-revalidate"
]
"content-length" => array:1 [
0 => "2273"
]
"content-type" => array:1 [
0 => "application/json"
]
"access-control-allow-origin" => array:1 [
0 => "*"
]
"apim-request-id" => array:1 [
0 => "72631d56-85a9-498d-b885-346af53d59e6"
]
"strict-transport-security" => array:1 [
0 => "max-age=31536000; includeSubDomains; preload"
]
"x-ms-region" => array:1 [
0 => "East US"
]
"x-content-type-options" => array:1 [
0 => "nosniff"
]
"openai-model" => array:1 [
0 => "text-davinci-003"
]
"openai-processing-ms" => array:1 [
0 => "3482.8264"
]
"x-accel-buffering" => array:1 [
0 => "no"
]
"x-ms-client-request-id" => array:1 [
0 => "72631d56-85a9-498d-b885-346af53d59e6"
]
"x-request-id" => array:1 [
0 => "a2896998-e276-4466-ac0e-5a211a8ecd3e"
]
"date" => array:1 [
0 => "Thu, 31 Aug 2023 09:34:33 GMT"
]
] headerNames: array:14 [ "cache-control" => "cache-control" "content-length" => "content-length" "content-type" => "content-type" "access-control-allow-origin" => "access-control-allow-origin" "apim-request-id" => "apim-request-id" "strict-transport-security" => "strict-transport-security" "x-ms-region" => "x-ms-region" "x-content-type-options" => "x-content-type-options" "openai-model" => "openai-model" "openai-processing-ms" => "openai-processing-ms" "x-accel-buffering" => "x-accel-buffering" "x-ms-client-request-id" => "x-ms-client-request-id" "x-request-id" => "x-request-id" "date" => "date" ]`
And we cannot used the 0.6.* version as for the chat endpoint response 'content' is always expected and throws an error when there is no content in the response. It was fixed in 0.7.0 with ?? null
addition.
Thank you @TarikHusovicContentoo
I am going to make a new release which fixes this issue in the next couple of hours.
Fixed in v0.7.2
@TarikHusovicContentoo could you please provide a feedback if this now works for you?
@gehrisandro Works like a charm, thanks!
After upgrading to version 0.7.1 I get the following message.
My call that call the API is:
`ErrorException {#1365 // app/Services/OpenAIService.php:311
message: "Undefined array key "openai-version""
code: 0
file: "/home/labs/vendor/openai-php/client/src/Responses/Meta/MetaInformation.php"
line: 36
severity: E_WARNING
trace: { /home/labs/vendor/openai-php/client/src/Responses/Meta/MetaInformation.php:36 { Illuminate\Foundation\Bootstrap\HandleExceptions->handleError($level, $message, $file = '', $line = 0, $context = []) … › 'organization' => $headers['openai-organization'][0] ?? null, › 'version' => $headers['openai-version'][0], › 'processingMs' => (int) $headers['openai-processing-ms'][0], } /home/labs/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php:270 { Illuminate\Foundation\Bootstrap\HandleExceptions->Illuminate\Foundation\Bootstrap{closure} … › return fn (...$arguments) => static::$app › ? $this->{$method}(...$arguments) › : false; } /home/labs/vendor/openai-php/client/src/Responses/Meta/MetaInformation.php:36 { OpenAI\Responses\Meta\MetaInformation::from(array $headers): self … › 'organization' => $headers['openai-organization'][0] ?? null, › 'version' => $headers['openai-version'][0], › 'processingMs' => (int) $headers['openai-processing-ms'][0], }....`
Same thing happens on chat resource. I have tried with gpt3 and gpt4 models.