psychic-api / doctran

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

asynchronous support

hello-z opened this issue · comments

The code on github is out of sync with that in pypi, but
It seems that async is not used when calling the openai.ChatCompletion.create function, as follows:

# doctran/transformers/transformers.py
completion = self.config.openai.ChatCompletion.create(**function_call.dict())
arguments = completion.choices[0].message["function_call"]["arguments"]

Maybe it should?

# doctran/transformers/transformers.py
completion = await self.config.openai.ChatCompletion.acreate(**function_call.dict())
arguments = completion.choices[0].message["function_call"]["arguments"]