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
“message”: “Task execution is aborted due to timeout”,
Steps to reproduce
- run createSession to obtain sessionID
- run sendMessage with obtained sessionID and question string
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
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.
Thanks, I tried a very simple prompt and it worked. I will try Vlads solution to enhance execution time.