rodrigomasini commited on
Commit
5747d32
·
verified ·
1 Parent(s): 0663556

Update helper.py

Browse files
Files changed (1) hide show
  1. helper.py +2 -3
helper.py CHANGED
@@ -39,9 +39,8 @@ def get_fn(model_name: str, **model_kwargs) -> Callable:
39
  response_text = ""
40
  # Iterate over the streaming response
41
  for chunk in response:
42
- if 'choices' in chunk and len(chunk['choices']) > 0:
43
- delta = chunk['choices'][0].get('delta', {})
44
- content = delta.get('content', '')
45
  if content:
46
  response_text += content
47
  yield response_text.strip()
 
39
  response_text = ""
40
  # Iterate over the streaming response
41
  for chunk in response:
42
+ if len(chunk.choices[0]) > 0:
43
+ content = chunk.choices[0].delta.content
 
44
  if content:
45
  response_text += content
46
  yield response_text.strip()