Skip to content

bugfix(Azure): fix index out of range error due to Azure Openai reponses an empty chunk at first#820

Merged
fangyinc merged 2 commits intoeosphoros-ai:mainfrom
zfanswer:develop
Nov 28, 2023
Merged

bugfix(Azure): fix index out of range error due to Azure Openai reponses an empty chunk at first#820
fangyinc merged 2 commits intoeosphoros-ai:mainfrom
zfanswer:develop

Conversation

@zfanswer
Copy link
Copy Markdown
Contributor

Description

image

Azure Openai reponse may have an empty chunk at the first streming response, i.e. the "choices" key have an empty list.
This will cause the error from reponse json parser.

You can see the "choices": [] at the first response.
image

Solution

Do a empty/None check before parse the response json.

fangyinc
fangyinc previously approved these changes Nov 22, 2023
Copy link
Copy Markdown
Member

@fangyinc fangyinc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@fangyinc
Copy link
Copy Markdown
Member

Hi, @zfanswer, thank you for your PR. Please address the code formatting issues. You can install black with pip install black, and then run black . in the project directory to format the Python code.

@zfanswer
Copy link
Copy Markdown
Contributor Author

Hi, @zfanswer, thank you for your PR. Please address the code formatting issues. You can install black with pip install black, and then run black . in the project directory to format the Python code.

didn't get the notice,...
black . is done.

@fangyinc fangyinc added model Module: model fix Bug fixes and removed Waiting for reply labels Nov 28, 2023
Copy link
Copy Markdown
Member

@fangyinc fangyinc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@fangyinc fangyinc merged commit 0b02451 into eosphoros-ai:main Nov 28, 2023
@zfanswer zfanswer deleted the develop branch December 5, 2023 07:58
Hopshine pushed a commit to Hopshine/DB-GPT that referenced this pull request Sep 10, 2024
…ses an empty chunk at first (eosphoros-ai#820)

Co-authored-by: 一帆 <zhang.f@digitalcnzz.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fix Bug fixes model Module: model

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants