-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmessage_role_filter.py
33 lines (24 loc) · 1003 Bytes
/
message_role_filter.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
"""
message_role_filter.py
This module defines the MessageRoleFilter Enum class, used for specifying the role
of a message sender within the chat history. The enum facilitates filtering messages
based on the sender's role, ensuring consistency and type safety in role-related operations.
Classes:
MessageRoleFilter (Enum): An enumeration that represents different roles associated
with chat messages.
Enum Members:
SYSTEM_ROLE: Indicates a message sent by the system.
USER_ROLE: Indicates a message sent by a user.
ASSISTANT_ROLE: Indicates a message sent by an assistant or chatbot.
Example Usage:
from message_role_filter import MessageRoleFilter
# Example of using the enum for filtering
role = MessageRoleFilter.USER_ROLE
if message['role'] == role.value:
# Process user messages
"""
from enum import Enum
class MessageRoleFilter(Enum):
SYSTEM_ROLE = 'system'
USER_ROLE = 'user'
ASSISTANT_ROLE = 'assistant'