From 2ad180b27fef9442126d04b91ee7fcc23e3067dd Mon Sep 17 00:00:00 2001 From: "@fanny.gaudin" Date: Wed, 13 Nov 2024 11:26:22 +0100 Subject: [PATCH] fix(LAB-3244): remove order on already sorted chat_items --- src/kili/llm/services/export/dynamic.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/kili/llm/services/export/dynamic.py b/src/kili/llm/services/export/dynamic.py index b0ddedf2c..0b39037eb 100644 --- a/src/kili/llm/services/export/dynamic.py +++ b/src/kili/llm/services/export/dynamic.py @@ -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: