fix wrong func.

This commit is contained in:
Cyberes 2023-04-19 13:27:04 -06:00
parent 12cd48f075
commit 924f1caa39
1 changed files with 4 additions and 2 deletions

View File

@ -191,8 +191,10 @@ async def process_chat(
# I don't think the OpenAI py api has a built-in timeout
@stopit.threading_timeoutable(default=(None, None))
async def generate():
if openai_model in ['gpt-3', 'gpt-4']:
return await loop.run_in_executor(None, functools.partial(openai_obj.ChatCompletion.create, model=openai_model, messages=messages, temperature=openai_temperature, timeout=20))
# r = openai_obj.ChatCompletion.create(model=openai_model, messages=messages, temperature=openai_temperature, timeout=20)
elif openai_model in ['text-davinci-003', 'davinci-instruct-beta', 'text-davinci-001', 'text-davinci-002', 'text-curie-001', 'text-babbage-001']:
return await loop.run_in_executor(None, functools.partial(openai_obj.Completion.create, model=openai_model, temperature=openai_temperature, timeout=20))
response = None
for i in range(openai_retries):