Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
OpenDAS
vllm_cscc
Commits
cdb57015
Unverified
Commit
cdb57015
authored
Apr 02, 2025
by
Chauncey
Committed by
GitHub
Apr 02, 2025
Browse files
[Misc] Replace print with logger (#15923)
Signed-off-by:
chaunceyjiang
<
chaunceyjiang@gmail.com
>
parent
aa557e64
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
5 deletions
+7
-5
vllm/entrypoints/openai/tool_parsers/phi4mini_tool_parser.py
vllm/entrypoints/openai/tool_parsers/phi4mini_tool_parser.py
+7
-5
No files found.
vllm/entrypoints/openai/tool_parsers/phi4mini_tool_parser.py
View file @
cdb57015
...
@@ -47,13 +47,13 @@ class Phi4MiniJsonToolParser(ToolParser):
...
@@ -47,13 +47,13 @@ class Phi4MiniJsonToolParser(ToolParser):
"""
"""
Extract the tool calls from a complete model response.
Extract the tool calls from a complete model response.
"""
"""
print
(
f
"Model output:
{
model_output
}
"
)
logger
.
debug
(
"Model output:
%s"
,
model_output
)
pattern
=
r
'functools\[(.*?)\]'
pattern
=
r
'functools\[(.*?)\]'
matches
=
re
.
search
(
pattern
,
model_output
,
re
.
DOTALL
)
matches
=
re
.
search
(
pattern
,
model_output
,
re
.
DOTALL
)
if
not
matches
:
if
not
matches
:
print
(
"No function calls found"
)
logger
.
debug
(
"No function calls found"
)
return
ExtractedToolCallInformation
(
tools_called
=
False
,
return
ExtractedToolCallInformation
(
tools_called
=
False
,
tool_calls
=
[],
tool_calls
=
[],
content
=
model_output
)
content
=
model_output
)
...
@@ -64,10 +64,12 @@ class Phi4MiniJsonToolParser(ToolParser):
...
@@ -64,10 +64,12 @@ class Phi4MiniJsonToolParser(ToolParser):
json_content
=
'['
+
matches
.
group
(
1
)
+
']'
json_content
=
'['
+
matches
.
group
(
1
)
+
']'
function_call_arr
=
json
.
loads
(
json_content
)
function_call_arr
=
json
.
loads
(
json_content
)
print
(
f
"Successfully extracted
{
len
(
function
_
call
_arr
)
}
"
logger
.
debug
(
"Successfully extracted
%d
function
call
s"
,
"
function
call
s"
)
len
(
function
_
call
_arr
)
)
except
json
.
JSONDecodeError
as
e
:
except
json
.
JSONDecodeError
as
e
:
print
(
f
"Error parsing JSON:
{
e
}
"
)
logger
.
error
(
"Failed to parse function calls from model output: %s. "
"Error: %s"
,
model_output
,
str
(
e
))
tool_calls
:
list
[
ToolCall
]
=
[
tool_calls
:
list
[
ToolCall
]
=
[
ToolCall
(
ToolCall
(
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment