Skip to content

Commit

Permalink
fix(LAB-3244): remove order on already sorted chat_items
Browse files Browse the repository at this point in the history
  • Loading branch information
FannyGaudin committed Nov 13, 2024
1 parent dc48337 commit c41ba47
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/kili/llm/services/export/dynamic.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,9 @@ def _init_round(self, context):

def _build_rounds(self, chat_items, annotations, json_interface):
"""A round is composed of a prompt with n pre-prompts and n completions."""
ordered_chat_items = sorted(chat_items, key=lambda x: x["createdAt"])
rounds = []
current_round = self._init_round([])
for chat_item in ordered_chat_items:
for chat_item in chat_items:
role = chat_item["role"].lower() if chat_item["role"] else None
if role == "user" or role == "system":
if current_round["prompt"] is not None:
Expand Down

0 comments on commit c41ba47

Please sign in to comment.