snorkelflow_extensions.taxonomy_distillation.generation.MessageBuilder
- class snorkelflow_extensions.taxonomy_distillation.generation.MessageBuilder(root_taxonomy: Taxonomy)
Bases:
objectBuilder for creating structured conversation messages in taxonomy workflows.
MessageBuildergenerates formatted prompts and message sequences for language model interactions during taxonomy creation and refinement. It transforms taxonomy data into conversation-ready formats suitable for various prompting strategies and workflow phases.The builder supports multiple message generation patterns including:
Initial taxonomy creation prompts
Property refinement conversations
Data-driven taxonomy improvement workflows
Continuation messages for iterative development
All generated messages follow consistent formatting patterns optimized for language model comprehension and taxonomy generation tasks.
- __init__(root_taxonomy: Taxonomy) None
Initialize the message builder. :param root_taxonomy: Root taxonomy instance that defines the classification hierarchy
and serves as the foundation for all generated messages.
\_\_init\_\_
__init__
Methods
__init__(root_taxonomy)Initialize the message builder. :param root_taxonomy: Root taxonomy instance that defines the classification hierarchy and serves as the foundation for all generated messages. :type root_taxonomy: Taxonomy. build_data_driven_taxonomy_refinement_messages(...)Build conversation messages for data-driven taxonomy refinement. build_initial_creation_messages()Build initial conversation messages for taxonomy creation. build_taxonomy_property_brainstorming_continuation_messages(...)Use the provided taxonomy root prompt and accepted properties string to construct the continuation messages for taxonomy creation. build_taxonomy_property_refinement_messages(...)Construct the messages for taxonomy refinement. - build_data_driven_taxonomy_refinement_messages(refinement_property: Property, in_domain_examples: list) List[Message]
Build conversation messages for data-driven taxonomy refinement.
Creates messages that include property refinement context and in-domain examples to guide iterative taxonomy improvement.
Parameters
Parameters
Returns
Returns
Messages for data-driven taxonomy refinement conversation.
Return type
Return type
list of Message
Name Type Default Info refinement_property (Property) – Property object to be refined using the provided examples. in_domain_examples listList of domain-specific text examples to inform refinement.
build\_data\_driven\_taxonomy\_refinement\_messages
build_data_driven_taxonomy_refinement_messages
- build_initial_creation_messages() List[Message]
Build initial conversation messages for taxonomy creation.
Constructs system and user messages containing the brainstorm prompt and taxonomy root information to initiate taxonomy creation workflow.
build\_initial\_creation\_messages
build_initial_creation_messages
- build_taxonomy_property_brainstorming_continuation_messages(accepted_properties: List[Property]) List[Message]
Use the provided taxonomy root prompt and accepted properties string to construct the continuation messages for taxonomy creation. :param accepted_properties: The accepted Property objects.
Returns: The continuation messages for taxonomy creation.
build\_taxonomy\_property\_brainstorming\_continuation\_messages
build_taxonomy_property_brainstorming_continuation_messages
- build_taxonomy_property_refinement_messages(refinement_property: Property) List[Message]
Construct the messages for taxonomy refinement. :param refinement_property: The refinement property.
Returns: The messages for taxonomy refinement.
build\_taxonomy\_property\_refinement\_messages
build_taxonomy_property_refinement_messages