OpenAI Service - Task execution is aborted due to timeout

Application ID: 380B80F0-E977-F61C-FF64-4BFE5387B900

Problem description

I installed OpenAI Service from the marketplace. I set up successfully the API connection to OpenAI. createSession and getSessionMessages are working. sendMessage however returns:

400 - Task execution is aborted due to timeout
{
“code”: 0,
“message”: “Task execution is aborted due to timeout”,
“errorData”: {}
}

Steps to reproduce

OpenAI service:

  1. run createSession to obtain sessionID
  2. run sendMessage with obtained sessionID and question string

Hi @Christian_Weber

OpenAI takes time to process requests depending on the messages you send.

Consider installing a function pack “Enhanced Script/Code Execution Time (20 sec)” to extend the time for running CloudCode. You can find it in our Marketplace in the “MBAAS FUNCTION PACKS” => “Business Logic” category

Regards,
Vlad

Hi Christian,

An API service in Backendless should complete its execution in 5 seconds; this includes the time an external service takes to respond. Try a simple prompt that goes to the completion API in OpenAI and see if you get a response. For more complex queries (those taking more than 5 seconds), the solution provided by @vladimir-upirov should work.

Regards,
Mark

Thanks, I tried a very simple prompt and it worked. I will try Vlads solution to enhance execution time.