This commit is contained in:
@@ -127,12 +127,12 @@ class OpenAIServingChat(OpenAIServingBase):
|
||||
request.skip_special_tokens = False
|
||||
if not isinstance(request.tool_choice, str):
|
||||
tools = [
|
||||
item.model_dump()
|
||||
item.function.model_dump()
|
||||
for item in request.tools
|
||||
if item.function.name == request.tool_choice.function.name
|
||||
]
|
||||
else:
|
||||
tools = [item.model_dump() for item in request.tools]
|
||||
tools = [item.function.model_dump() for item in request.tools]
|
||||
|
||||
tool_call_parser = self.tokenizer_manager.server_args.tool_call_parser
|
||||
parser = FunctionCallParser(request.tools, tool_call_parser)
|
||||
@@ -178,25 +178,6 @@ class OpenAIServingChat(OpenAIServingBase):
|
||||
audio_data,
|
||||
modalities,
|
||||
)
|
||||
|
||||
if "tool_calls" in processed_msg and isinstance(
|
||||
processed_msg.get("tool_calls"), list
|
||||
):
|
||||
for call in processed_msg["tool_calls"]:
|
||||
try:
|
||||
if "arguments" in call["function"] and isinstance(
|
||||
call["function"]["arguments"], str
|
||||
):
|
||||
call["function"]["arguments"] = json.loads(
|
||||
call["function"]["arguments"]
|
||||
)
|
||||
except json.JSONDecodeError as e:
|
||||
# Log a warning or error if JSON parsing fails for arguments
|
||||
logger.warning(
|
||||
f"Failed to parse tool call arguments as JSON: {e}"
|
||||
)
|
||||
# Decide whether to continue or raise the exception based on desired behavior
|
||||
continue # Or raise e if strict parsing is required
|
||||
openai_compatible_messages.append(processed_msg)
|
||||
|
||||
# Handle assistant prefix for continue_final_message
|
||||
|
||||
Reference in New Issue
Block a user