Skip to content
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

Completions requesting gpt-4 models timeout (Error: Gateway timeout.) #81

Closed
testgonzo opened this issue Apr 11, 2023 · 3 comments
Closed
Labels
bug Something isn't working

Comments

@testgonzo
Copy link

testgonzo commented Apr 11, 2023

Describe the bug

Calls to $openai->chat with large messages and max_tokens length (~4K + ~4K respectively for a total of 8K) are often timing out. Meaning php script that calls function exits after 10 minutes while waiting for response without receiving response and some times receiving response "Error: Gateway timeout." Calling the same script from a web browser will fail earlier before any response to endpoint call received.

This does not happen every time, but has occurred almost every time $openai->chat is called with large context.

Is there:

  1. An alternative way to request large context completion that is less likely to fail in this manner?

  2. A way to request a timeout -- meaning a termination of the endpoint request along with explicit error response if OpenAI endpoint does not respond within a specified amount of time?

  3. A way to keep the API call and/or calling php script alive longer?

To Reproduce

$chat = $openai->chat([
	'model' => 'gpt-4-0314',
	'messages' => "MESSAGE ~4K tokens in length)
	'temperature' => 0,
	'max_tokens' => 4l000,
	'frequency_penalty' => 0,
	'presence_penalty' => 0
]);
echo json_decode($chat);

Code snippets

No response

OS

Linux

PHP version

PHP 7.6

Library version

openai v3

@testgonzo testgonzo added the bug Something isn't working label Apr 11, 2023
@testgonzo testgonzo changed the title Completions requesting gpt-4 models timeout Completions requesting gpt-4 models timeout (Error: Gateway timeout.) Apr 11, 2023
@testgonzo
Copy link
Author

There is apparently an undocumented 600 second (10 minute) timeout parameter as per:

https://community.openai.com/t/frequent-api-timeout-errors-recently/106903/8?u=fp

@orhanerday
Copy link
Owner

orhanerday commented Apr 11, 2023

This issue is OpenAI API related, I can't do anything about it. We can wait to solve the issue by OpenAI.

@testgonzo
Copy link
Author

testgonzo commented Apr 11, 2023

  1. Does the $client->setTimeout(x) functionality described in #31 for completion endpoint address question (2) posed in the opening post of this thread for completion, chat, and all endpoints?

  2. Appears completions timedout in this manner do not return any data to function call. Is there a way to have calls timedout this way return a specific message indicating library timeout occurred (as opposed to OpenAI timeout)?

  3. Would it be helpful to start a thread in this github in which we can all share our experiences with OpenAI timeout issues to help collectively track API performance? Sort of like a "down detector" for OpenAI.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants