@tduncan / Nvidia-Optimization-Stack-VLLM Mirror · read-only / commits / cdb57015a7
Fork 0

A high-throughput and memory-efficient inference and serving engine for LLMs

Mirrored from https://github.com/tduncan-lum/Nvidia-Optimization-Stack---VLLM.git

Synced Nov 15, 16:00 UTC

[Misc] Replace print with logger (#15923)

Signed-off-by: chaunceyjiang <chaunceyjiang@gmail.com>

Chauncey committed Apr 2, 2025 at 16:37 UTC cdb57015a7e09834d3d50e404b045d8667d7a5b4
1 file changed +7 -5
vllm/entrypoints/openai/tool_parsers/phi4mini_tool_parser.py
+7 -5
@@ -47,13 +47,13 @@ class Phi4MiniJsonToolParser(ToolParser):
47 """
48 Extract the tool calls from a complete model response.
49 """
50 - print(f"Model output: {model_output}")
50 + logger.debug("Model output: %s", model_output)
51
52 pattern = r'functools\[(.*?)\]'
53 matches = re.search(pattern, model_output, re.DOTALL)
54
55 if not matches:
56 - print("No function calls found")
56 + logger.debug("No function calls found")
57 return ExtractedToolCallInformation(tools_called=False,
58 tool_calls=[],
59 content=model_output)
@@ -64,10 +64,12 @@ class Phi4MiniJsonToolParser(ToolParser):
64 json_content = '[' + matches.group(1) + ']'
65
66 function_call_arr = json.loads(json_content)
67 - print(f"Successfully extracted {len(function_call_arr)} "
68 - "function calls")
67 + logger.debug("Successfully extracted %d function calls",
68 + len(function_call_arr))
69 except json.JSONDecodeError as e:
70 - print(f"Error parsing JSON: {e}")
70 + logger.error(
71 + "Failed to parse function calls from model output: %s. "
72 + "Error: %s", model_output, str(e))
73
74 tool_calls: list[ToolCall] = [
75 ToolCall(