Easy-open-ai icon indicating copy to clipboard operation
Easy-open-ai copied to clipboard

getAsync* methods are actually synchronous

Open mircea-cm opened this issue 1 year ago • 1 comments

All getAsync methods are actually synchronous.

For example, getAsyncChatCompletion (in AsyncDAOImpl) returns a POJO object: ChatCompletionResponse, and it should return a Future<ChatCompletionResponse>.

You create a CompletableFuture (all well for now), but the method ends in

return (ChatCompletionResponse)future.get();

Basically, it blocks the current thread until the future completes.

For the methods to be actually async they need to return Call<> or Future

mircea-cm avatar Jan 30 '24 14:01 mircea-cm

@mircea-cm you are absolutely right, making a PR for this right now, should be fixed easily

namankhurpia avatar Feb 15 '24 17:02 namankhurpia