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
215bf150
Unverified
Commit
215bf150
authored
Feb 26, 2025
by
Florian Greinacher
Committed by
GitHub
Feb 26, 2025
Browse files
[Bugfix] Handle None parameters in Mistral function calls. (#13786)
parent
0ecdd980
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
2 deletions
+36
-2
tests/tokenization/test_mistral_tokenizer.py
tests/tokenization/test_mistral_tokenizer.py
+34
-1
vllm/transformers_utils/tokenizers/mistral.py
vllm/transformers_utils/tokenizers/mistral.py
+2
-1
No files found.
tests/tokenization/test_mistral_tokenizer.py
View file @
215bf150
...
...
@@ -41,6 +41,39 @@ from vllm.transformers_utils.tokenizers.mistral import (
)
],
),
),
(
{
"messages"
:
[{
"role"
:
"user"
,
"content"
:
"What is the current local date and time?"
,
}],
"tools"
:
[{
"type"
:
"function"
,
"function"
:
{
"description"
:
"Fetch the current local date and time."
,
"name"
:
"get_current_time"
,
"parameters"
:
None
,
},
}],
},
ChatCompletionRequest
(
messages
=
[
UserMessage
(
content
=
"What is the current local date and time?"
)
],
tools
=
[
Tool
(
type
=
"function"
,
function
=
Function
(
name
=
"get_current_time"
,
description
=
"Fetch the current local date and time."
,
parameters
=
{},
),
)
],
),
)],
)
def
test_make_mistral_chat_completion_request
(
openai_request
,
...
...
vllm/transformers_utils/tokenizers/mistral.py
View file @
215bf150
...
...
@@ -164,7 +164,8 @@ def make_mistral_chat_completion_request(
tool
[
"function"
]
for
tool
in
tools
if
tool
[
"type"
]
==
"function"
]:
function
.
setdefault
(
"parameters"
,
{})
if
function
.
get
(
"parameters"
)
is
None
:
function
[
"parameters"
]
=
{}
from
mistral_common.protocol.instruct.request
import
ChatCompletionRequest
return
ChatCompletionRequest
(
messages
=
messages
,
...
...
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