Skip to content

Commit

Permalink
Fix KeyError (#226)
Browse files Browse the repository at this point in the history
  • Loading branch information
liujiangning30 authored Aug 22, 2024
1 parent f01a211 commit cefbc50
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lagent/llms/openai.py
Original file line number Diff line number Diff line change
Expand Up @@ -286,11 +286,12 @@ def streaming(raw_response):
choice = response['choices'][0]
if choice['finish_reason'] == 'stop':
return
yield choice['delta']['content']
yield choice['delta'].get('content', '')
except Exception as exc:
print(
f'response {decoded} lead to exception of {str(exc)}'
)
raise

assert isinstance(messages, list)

Expand Down

0 comments on commit cefbc50

Please sign in to comment.