Malina Claude Sonnet 4.6 commited on
Commit
165807e
·
1 Parent(s): 3e1b026

Fix synthesis IndexError: guard against empty choices in HF stream events

Browse files
Files changed (1) hide show
  1. synthesis.py +2 -0
synthesis.py CHANGED
@@ -197,6 +197,8 @@ def llm_synthesize_stream(
197
  stream=True,
198
  )
199
  for ev in stream:
 
 
200
  delta = ev.choices[0].delta.content or ""
201
  if delta:
202
  acc += delta
 
197
  stream=True,
198
  )
199
  for ev in stream:
200
+ if not ev.choices:
201
+ continue
202
  delta = ev.choices[0].delta.content or ""
203
  if delta:
204
  acc += delta