From f035d166c88f126c7c7ab88fe7ad1e884493f6f1 Mon Sep 17 00:00:00 2001 From: Shuguang Chen <54548843+nehcgs@users.noreply.github.com> Date: Fri, 28 Mar 2025 16:30:03 -0700 Subject: [PATCH] Fix hallucination check --- model_server/src/commons/globals.py | 2 +- model_server/src/core/function_calling.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/model_server/src/commons/globals.py b/model_server/src/commons/globals.py index 3712178e..a477a939 100644 --- a/model_server/src/commons/globals.py +++ b/model_server/src/commons/globals.py @@ -15,7 +15,7 @@ logger = get_model_server_logger() # Define the client -ARCH_ENDPOINT = os.getenv("ARCH_ENDPOINT", "https://archfc.katanemo.dev/v1") +# ARCH_ENDPOINT = os.getenv("ARCH_ENDPOINT", "https://archfc.katanemo.dev/v1") ARCH_ENDPOINT = os.getenv("ARCH_ENDPOINT", "http://35.225.55.128:8000/v1") ARCH_API_KEY = "EMPTY" ARCH_CLIENT = OpenAI(base_url=ARCH_ENDPOINT, api_key=ARCH_API_KEY) diff --git a/model_server/src/core/function_calling.py b/model_server/src/core/function_calling.py index ac6c2605..1aa9ad46 100644 --- a/model_server/src/core/function_calling.py +++ b/model_server/src/core/function_calling.py @@ -417,7 +417,7 @@ class ArchFunctionHandler(ArchBaseHandler): has_tool_calls, has_hallucination = None, False for _ in self.hallucination_state: # check if the first token is - if len(self.hallucination_state.tokens) > 2 and has_tool_calls is None: + if len(self.hallucination_state.tokens) > 5 and has_tool_calls is None: content = "".join(self.hallucination_state.tokens) if "tool_calls" in content: has_tool_calls = True