srcnalt / OpenAI-Unity

An unofficial OpenAI Unity Package that aims to help you use OpenAI API directly in Unity Game engine.
MIT License
672 stars 150 forks source link

Model currently overloaded #61

Closed Radlad-io closed 1 year ago

Radlad-io commented 1 year ago

This might be an issue or I may have missed something.

I've been intermittently receiving the following error in the console:

Error Message: That model is currently overloaded with other requests. You can retry your request, or contact us through our help center at help.openai.com if the error persists. (Please include the request ID 5afba5db32f54f11340d57aebeaf640d in your message.)
Error Type: server_error

UnityEngine.Debug:LogError (object)
OpenAI.OpenAIApi/<DispatchRequest>d__6`1<OpenAI.CreateChatCompletionResponse>:MoveNext () (at Library/PackageCache/com.srcnalt.openai-unity@5924018f2c/Runtime/OpenAIApi.cs:85)
UnityEngine.UnitySynchronizationContext:ExecuteTasks ()

It's obvious that OpenAI / ChatGPT's API is busy but Is there are way to catch and redirect this error?

I'm new to Unity (JavaScript developer), normally I would wrap network request in a Try Catch block, but I'm not sure if this throws an exception or just logs the issue to console.

srcnalt commented 1 year ago

There is no Unity side exception in this case, this is direct response from OpenAI API. Request successfully finalizes and brings the error message OpenAI sent to Unity side.

Radlad-io commented 1 year ago

Got it! I changed my approach, thank you for confirming. I looked over the API response codes and OpenAI's implementation seems short sighted.