Support defer_loading field at function level for Chat Completions API (#22702)

Co-authored-by: Xinyuan Tong <115166877+JustinTong0323@users.noreply.github.com>
This commit is contained in:
Yuxuan Zhang
2026-04-22 10:09:54 -07:00
committed by GitHub
co-authored by Xinyuan Tong
parent 92f28e9ba8
commit 28cfd3d272
5 changed files with 145 additions and 28 deletions
@@ -201,6 +201,11 @@ def process_content_for_template_format(
else:
# Keep text content as-is for openai format
processed_content_parts.append(chunk)
elif chunk_type == "tool_reference":
# GLM-specific extension: pass through so the chat template
# can match tool_reference.name against tools[*].function.name
# and render the referenced tool schemas inline.
processed_content_parts.append(chunk)
new_msg = {
k: v for k, v in msg_dict.items() if v is not None and k != "content"