fix(openai): honor tool_choice=none in DeepSeek encoders (#43006)
Co-authored-by: ai-jz <ai-jz@users.noreply.github.com> Co-authored-by: Xinyuan Tong <115166877+JustinTong0323@users.noreply.github.com>
This commit is contained in:
co-authored by
ai-jz
Xinyuan Tong
parent
40f5d9411f
commit
4d5692b6cd
@@ -1590,18 +1590,20 @@ class OpenAIServingChat(OpenAIServingBase):
|
||||
messages, request
|
||||
)
|
||||
|
||||
request_tools = request.tools if tools else None
|
||||
|
||||
# An empty system message hosts the request tools; dsv41 renders a
|
||||
# system token for it, so it only gets one when tools need the host.
|
||||
if messages[0]["role"] != "system" and (request.tools or not is_dsv41):
|
||||
if messages[0]["role"] != "system" and (request_tools or not is_dsv41):
|
||||
messages.insert(0, {"role": "system", "content": ""})
|
||||
if request.tools:
|
||||
if request_tools:
|
||||
messages[0]["tools"] = [
|
||||
(
|
||||
chat_encoding.dsv41_tool_payload(tool)
|
||||
if is_dsv41
|
||||
else tool.model_dump()
|
||||
)
|
||||
for tool in request.tools
|
||||
for tool in request_tools
|
||||
]
|
||||
|
||||
# Default encoding (dsv4/dsv41/dsv32)
|
||||
|
||||
Reference in New Issue
Block a user