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
beb16b2c
Unverified
Commit
beb16b2c
authored
Dec 10, 2024
by
Travis Johnson
Committed by
GitHub
Dec 10, 2024
Browse files
[Bugfix] Handle <|tool_call|> token in granite tool parser (#11039)
Signed-off-by:
Travis Johnson
<
tsjohnso@us.ibm.com
>
parent
fe2e10c7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
1 deletion
+3
-1
vllm/entrypoints/openai/tool_parsers/granite_tool_parser.py
vllm/entrypoints/openai/tool_parsers/granite_tool_parser.py
+3
-1
No files found.
vllm/entrypoints/openai/tool_parsers/granite_tool_parser.py
View file @
beb16b2c
...
@@ -35,11 +35,13 @@ class GraniteToolParser(ToolParser):
...
@@ -35,11 +35,13 @@ class GraniteToolParser(ToolParser):
def
__init__
(
self
,
tokenizer
:
AnyTokenizer
):
def
__init__
(
self
,
tokenizer
:
AnyTokenizer
):
super
().
__init__
(
tokenizer
)
super
().
__init__
(
tokenizer
)
self
.
bot_token
=
"<|tool_call|>"
def
extract_tool_calls
(
def
extract_tool_calls
(
self
,
model_output
:
str
,
self
,
model_output
:
str
,
request
:
ChatCompletionRequest
)
->
ExtractedToolCallInformation
:
request
:
ChatCompletionRequest
)
->
ExtractedToolCallInformation
:
stripped
=
model_output
.
strip
()
# remove whitespace and the BOT token if it exists
stripped
=
model_output
.
strip
().
removeprefix
(
self
.
bot_token
).
lstrip
()
if
not
stripped
or
stripped
[
0
]
!=
'['
:
if
not
stripped
or
stripped
[
0
]
!=
'['
:
return
ExtractedToolCallInformation
(
tools_called
=
False
,
return
ExtractedToolCallInformation
(
tools_called
=
False
,
tool_calls
=
[],
tool_calls
=
[],
...
...
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