[Bugfix][Tool Call] Add null system prompt to support tool system prompt (#15092)
Signed-off-by: Muqi Li <muqi1029@gmail.com>
This commit is contained in:
@@ -293,6 +293,10 @@ class OpenAIServingChat(OpenAIServingBase):
|
|||||||
)
|
)
|
||||||
messages = request.messages
|
messages = request.messages
|
||||||
messages = [msg.model_dump() for msg in messages]
|
messages = [msg.model_dump() for msg in messages]
|
||||||
|
|
||||||
|
if messages[0]["role"] != "system":
|
||||||
|
# insert an empty system prompt to help render tool system prompt
|
||||||
|
messages.insert(0, {"role": "system", "content": ""})
|
||||||
if request.tools:
|
if request.tools:
|
||||||
messages[0]["tools"] = [tool.model_dump() for tool in request.tools]
|
messages[0]["tools"] = [tool.model_dump() for tool in request.tools]
|
||||||
real_input = encode_messages(messages, thinking_mode=thinking_mode)
|
real_input = encode_messages(messages, thinking_mode=thinking_mode)
|
||||||
|
|||||||
Reference in New Issue
Block a user