Skip to content

Commit

Permalink
Merge pull request #560 from thanseefpp/streamfix
Browse files Browse the repository at this point in the history
Streaming AIApplication error with Azure OpenAI API #541 fixed
  • Loading branch information
zzstoatzz authored Sep 8, 2023
2 parents 9e46f44 + f0f3521 commit 3774b95
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/marvin/engine/language_models/openai.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,10 @@ async def handle_streaming_response(
async for r in api_response:
response["llm_response"] = r.to_dict_recursive()

delta = r.choices[0].delta
delta = r.choices[0].delta if r.choices and r.choices[0] else None

if delta is None:
continue

if "role" in delta:
response["role"] = delta.role
Expand Down

0 comments on commit 3774b95

Please sign in to comment.