Skip to main content

snorkelflow_extensions.taxonomy_distillation.entities.Message

class snorkelflow_extensions.taxonomy_distillation.entities.Message(role: Literal['system', 'user', 'assistant'], content: str)

Bases: object

A structured conversation message for language model APIs.

Messages encapsulate individual conversation turns with language models, combining role-based metadata with textual content. The role indicates the message source (system instructions, user input, or assistant response) while the content contains the actual text.

These messages are fundamental building blocks for constructing prompts in teacher-student distillation workflows, enabling structured conversations with language models for taxonomy generation and refinement.

__init__

__init__(role: Literal['system', 'user', 'assistant'], content: str) None

Methods

__init__(role, content)
to_dict()Convert the message to dictionary format.

Attributes

role
content
content: str
role: Literal['system', 'user', 'assistant']

to_dict

to_dict() Dict[str, str]

Convert the message to dictionary format.

Creates a dictionary representation suitable for language model APIs that expect messages in {'role': str, 'content': str} format.

Returns

Dictionary with 'role' and 'content' keys for API consumption.

Return type

dict