fix wrong func.
This commit is contained in:
parent
12cd48f075
commit
924f1caa39
|
@ -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():
|
||||
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)
|
||||
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))
|
||||
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):
|
||||
|
|
Loading…
Reference in New Issue