Skip to content

Commit

Permalink
fixed: The choices may be empty. (#876)
Browse files Browse the repository at this point in the history
### What problem does this PR solve?


### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
  • Loading branch information
dashi6174 authored May 22, 2024
1 parent be13429 commit 21453ff
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions rag/llm/chat_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ def chat_streamly(self, system, history, gen_conf):
stream=True,
**gen_conf)
for resp in response:
if len(resp.choices) == 0:continue
if not resp.choices[0].delta.content:continue
ans += resp.choices[0].delta.content
total_tokens += 1
Expand Down

0 comments on commit 21453ff

Please sign in to comment.