Skip to content

Commit

Permalink
feat(LAB-3307): add externalId on chat items for `importConversatio…
Browse files Browse the repository at this point in the history
…ns`, send label with new format
  • Loading branch information
paulruelle committed Dec 19, 2024
1 parent 9d5fcf8 commit 7c64a9c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
4 changes: 3 additions & 1 deletion src/kili/adapters/kili_api_gateway/llm/mappers.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,12 +145,14 @@ def map_import_conversations_input(conversations: List[Conversation]) -> Dict:
"chatItems": [
{
"content": chat_item["content"],
"externalId": chat_item.get("external_id"),
"role": chat_item["role"],
"modelName": chat_item.get("model_name"),
}
for chat_item in conversation["chat_items"]
],
"chatExternalId": conversation.get("chat_external_id"),
"externalId": conversation.get("external_id"),
"label": conversation.get("label"),
"labeler": conversation["labeler"],
"metadata": conversation.get("metadata"),
}
Expand Down
13 changes: 11 additions & 2 deletions src/kili/domain/llm.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,13 +139,22 @@ class ChatItem(TypedDict):
"""Dict that represents a ChatItem."""

content: str
id: str
external_id: str
model_name: Optional[str]
role: ChatItemRole


class ConversationLabel(TypedDict):
"""Dict that represents a ConversationLabel."""

completion: Optional[Dict]
conversation: Optional[Dict]
round: Optional[Dict]


class Conversation(TypedDict):
chat_external_id: Optional[str]
external_id: Optional[str]
chat_items: List[ChatItem]
label: Optional[ConversationLabel]
labeler: str
metadata: Optional[dict]

0 comments on commit 7c64a9c

Please sign in to comment.