Skip to content

Commit 456e3e1

Browse files
蒋新军蒋新军
authored andcommitted
fix(backend): Handle missing content in streaming delta
1 parent 9573703 commit 456e3e1

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/guidellm/backend/openai.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -688,7 +688,7 @@ def _extract_completions_delta_content(
688688
return data["choices"][0]["text"]
689689

690690
if type_ == "chat_completions":
691-
return data["choices"][0]["delta"]["content"]
691+
return data.get("choices", [{}])[0].get("delta", {}).get("content")
692692

693693
raise ValueError(f"Unsupported type: {type_}")
694694

0 commit comments

Comments
 (0)