From cd812ee204bc45e2f8cb55984c3eb7cd580e5b19 Mon Sep 17 00:00:00 2001 From: yaya <640297@qq.com> Date: Thu, 27 Jun 2024 14:51:46 +0800 Subject: [PATCH] bugfix add support for dynamic setting of max_length --- openai_api.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/openai_api.py b/openai_api.py index 3d12822..ac56aaf 100644 --- a/openai_api.py +++ b/openai_api.py @@ -397,6 +397,8 @@ async def create_chat_completion(request: ChatCompletionRequest): gen_kwargs['temperature'] = request.temperature if request.top_p is not None: gen_kwargs['top_p'] = request.top_p + if request.max_length is not None: + gen_kwargs['max_length'] = request.max_length stop_words = add_extra_stop_words(request.stop) if request.functions: