A high-throughput and memory-efficient inference and serving engine for LLMs
Mirrored from https://github.com/tduncan-lum/Nvidia-Optimization-Stack---VLLM.git
Synced Nov 14, 05:30 UTC
Gracefully handle edge cases in harmony utils (#23155)
Signed-off-by: Jan Kessler <jakessle@uni-mainz.de> Co-authored-by: Chen Zhang <zhangch99@outlook.com> Co-authored-by: Cyrus Leung <tlleungac@connect.ust.hk>
Jan Kessler committed
Aug 28, 2025 at 05:14 UTC
a11adafdcab61c059d2a76d952367a722e1b71d5
1 file changed
+6
-6
vllm/entrypoints/harmony_utils.py
+6
-6
@@ -155,7 +155,7 @@ def parse_chat_input(chat_msg) -> Message:
155
contents = [TextContent(text=content)]
156
else:
157
# TODO: Support refusal.
158
- contents = [TextContent(text=c["text"]) for c in content]
158
+ contents = [TextContent(text=c.get("text", "")) for c in content]
159
msg = Message.from_role_and_contents(role, contents)
160
return msg
161
@@ -218,8 +218,8 @@ def parse_output_message(message: Message) -> list[ResponseOutputItem]:
218
)
219
output_items.append(reasoning_item)
220
elif message.channel == "commentary":
221
- if message.recipient.startswith("functions."):
222
- function_name = message.recipient.split(".")[-1]
221
+ if recipient is not None and recipient.startswith("functions."):
222
+ function_name = recipient.split(".")[-1]
223
for content in message.content:
224
random_id = random_uuid()
225
response_item = ResponseFunctionToolCall(
@@ -230,8 +230,8 @@ def parse_output_message(message: Message) -> list[ResponseOutputItem]:
230
id=f"ft_{random_id}",
231
)
232
output_items.append(response_item)
233
- elif message.recipient.startswith(
234
- "python") or message.recipient.startswith("browser"):
233
+ elif recipient is not None and (recipient.startswith("python")
234
+ or recipient.startswith("browser")):
235
for content in message.content:
236
reasoning_item = ResponseReasoningItem(
237
id=f"rs_{random_uuid()}",
@@ -245,7 +245,7 @@ def parse_output_message(message: Message) -> list[ResponseOutputItem]:
245
)
246
output_items.append(reasoning_item)
247
else:
248
- raise ValueError(f"Unknown recipient: {message.recipient}")
248
+ raise ValueError(f"Unknown recipient: {recipient}")
249
elif message.channel == "final":
250
contents = []
251
for content in message.content: