Skip to content

Commit 6b0945c

Browse files
committed
fix(backend): Handle missing content in streaming delta
Signed-off-by: xinjun.jiang <[email protected]>
1 parent 9573703 commit 6b0945c

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)