From d5c034ea79472718b174274432934f1c11804369 Mon Sep 17 00:00:00 2001 From: cotran Date: Fri, 6 Dec 2024 14:34:51 -0800 Subject: [PATCH] add else --- model_server/app/model_handler/function_calling.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/model_server/app/model_handler/function_calling.py b/model_server/app/model_handler/function_calling.py index 897c785a..76531c4d 100644 --- a/model_server/app/model_handler/function_calling.py +++ b/model_server/app/model_handler/function_calling.py @@ -79,8 +79,10 @@ class ArchIntentHandler(ArchBaseHandler): Returns: bool: A boolean value to indicate if any intent match with prompts or not """ - - return content.choices[0].message.content == "Yes" + if hasattr(content.choices[0].message, "content"): + return content.choices[0].message.content == "Yes" + else: + return False @override async def chat_completion(self, req: ChatMessage) -> ChatCompletionResponse: @@ -318,7 +320,7 @@ class ArchFunctionHandler(ArchBaseHandler): if required_param not in func_args: is_valid = False error_tool_call = tool_call - error_message = f"`{required_param}` is requried by the function `{func_name}` but not found in the tool call!" + error_message = f"`{required_param}` is requiried by the function `{func_name}` but not found in the tool call!" return is_valid, error_tool_call, error_message # Verify the data type of each parameter in the tool calls