Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
change
sglang
Commits
0ef583b7
"vscode:/vscode.git/clone" did not exist on "0d81e543a2b048d7b1f558fb1006d10a062a6e9e"
Unverified
Commit
0ef583b7
authored
Aug 26, 2025
by
GavinZhu-GMI
Committed by
GitHub
Aug 26, 2025
Browse files
fix: allow user to specify function as role (#9635)
parent
f7881a27
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
3 deletions
+3
-3
python/sglang/srt/entrypoints/openai/protocol.py
python/sglang/srt/entrypoints/openai/protocol.py
+3
-3
No files found.
python/sglang/srt/entrypoints/openai/protocol.py
View file @
0ef583b7
...
...
@@ -327,7 +327,7 @@ class ToolCall(BaseModel):
class
ChatCompletionMessageGenericParam
(
BaseModel
):
role
:
Literal
[
"system"
,
"assistant"
,
"tool"
]
role
:
Literal
[
"system"
,
"assistant"
,
"tool"
,
"function"
]
content
:
Union
[
str
,
List
[
ChatCompletionMessageContentTextPart
],
None
]
=
Field
(
default
=
None
)
...
...
@@ -341,9 +341,9 @@ class ChatCompletionMessageGenericParam(BaseModel):
def
_normalize_role
(
cls
,
v
):
if
isinstance
(
v
,
str
):
v_lower
=
v
.
lower
()
if
v_lower
not
in
{
"system"
,
"assistant"
,
"tool"
}:
if
v_lower
not
in
{
"system"
,
"assistant"
,
"tool"
,
"function"
}:
raise
ValueError
(
"'role' must be one of 'system', 'assistant',
or
'tool' (case-insensitive)."
"'role' must be one of 'system', 'assistant', 'tool
', or 'function
' (case-insensitive)."
)
return
v_lower
raise
ValueError
(
"'role' must be a string"
)
...
...
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