Skip to content

[Bugfix][Tool Call] Add null system prompt to support tool system prompt#15092

Merged
Fridge003 merged 3 commits intosgl-project:mainfrom
Muqi1029:bugfix/tool_prompt
Dec 16, 2025
Merged

[Bugfix][Tool Call] Add null system prompt to support tool system prompt#15092
Fridge003 merged 3 commits intosgl-project:mainfrom
Muqi1029:bugfix/tool_prompt

Conversation

@Muqi1029
Copy link
Copy Markdown
Contributor

Motivation

When no system prompt is provided, the tool prompt is not rendered, so the LLM does not know how to invoke or output the tool.

if role == "system":
prompt += system_msg_template.format(content=content or "")
if tools:
prompt += "\n\n" + render_tools(tools)
if response_format:
prompt += "\n\n" + response_format_template.format(
schema=to_json(response_format)
)

User prompt cannot render tool system prompt.

elif role == "user":
prompt += user_msg_template.format(content=content)
if index == last_user_idx and thinking_mode == "thinking":
prompt += thinking_start_token
else:
prompt += thinking_end_token

Modifications

Accuracy Tests

Benchmarking and Profiling

Checklist

@gemini-code-assist
Copy link
Copy Markdown
Contributor

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@Fridge003
Copy link
Copy Markdown
Collaborator

/tag-and-rerun-ci

@JustinTong0323
Copy link
Copy Markdown
Collaborator

We may need CI for the deepseek v3 chat rendering, but it's okay to merge it now.

@Fridge003 Fridge003 merged commit 1da5cd6 into sgl-project:main Dec 16, 2025
75 of 120 checks passed
tonyluj pushed a commit to openanolis/sglang that referenced this pull request Dec 17, 2025
jiaming1130 pushed a commit to zhuyijie88/sglang that referenced this pull request Dec 25, 2025
YChange01 pushed a commit to YChange01/sglang that referenced this pull request Jan 13, 2026
@Muqi1029 Muqi1029 deleted the bugfix/tool_prompt branch April 5, 2026 03:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants