Skip to content

Commit

Permalink
Add checking for message choices array
Browse files Browse the repository at this point in the history
  • Loading branch information
kxtran committed May 29, 2024
1 parent 384f7c8 commit 234ffd8
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions log10/_httpx_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -379,9 +379,11 @@ def parse_openai_responses(self, responses: list[str]):
finish_reason = r_json["choices"][0]["finish_reason"]

r_json["object"] = "chat.completion"
r_json["choices"].append(last_message_choices)

if finish_reason:
if last_message_choices:
r_json["choices"].append(last_message_choices)

if finish_reason and r_json["choices"]:
r_json["choices"][0]["finish_reason"] = finish_reason
return r_json

Expand Down

0 comments on commit 234ffd8

Please sign in to comment.