Skip to content

Commit

Permalink
fix(chatgpt): Resolve async response issue with Azure GPT-4o API (#1772)
Browse files Browse the repository at this point in the history
  • Loading branch information
JxQg authored Aug 5, 2024
1 parent d754168 commit 5bd946f
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions dbgpt/model/proxy/llms/chatgpt.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,9 @@ async def generate_stream_v1(
async for r in chat_completion:
if len(r.choices) == 0:
continue
# Check for empty 'choices' issue in Azure GPT-4o responses
if r.choices[0] is not None and r.choices[0].delta is None:
continue
if r.choices[0].delta.content is not None:
content = r.choices[0].delta.content
text += content
Expand Down

0 comments on commit 5bd946f

Please sign in to comment.