Skip to main content

snorkelflow_extensions.taxonomy_distillation.models.databricks.DataBricksTeacherZeroShotCOTHTC

class snorkelflow_extensions.taxonomy_distillation.models.databricks.DataBricksTeacherZeroShotCOTHTC(taxonomy: Taxonomy, config: Dict[str, Any])

Bases: TeacherHTC

Databricks-based teacher model using zero-shot chain-of-thought reasoning.

This implementation combines Databricks’ language model infrastructure with zero-shot chain-of-thought prompting to generate both classification labels and reasoning traces. The model first generates step-by-step reasoning about text classification, then extracts final classifications from that reasoning.

Provides interpretable classifications through reasoning traces while leveraging Databricks’ scalable model serving for enterprise-scale taxonomy distillation workflows.

__init__

__init__(taxonomy: Taxonomy, config: Dict[str, Any])

Initialize the teacher model. :param taxonomy: The taxonomy data class instance to use. :param config: The configuration dictionary.

Methods

__init__(taxonomy, config)Initialize the teacher model.
classify_text(text)Classify the text.
classify_texts(texts)Classify a list of texts.
create_few_shot_classification_prompt(...[, ...])Create a prompt for few-shot classification using the provided taxonomy and classes.
create_zero_shot_cot_answer_extraction_prompt(...)Create a prompt for zero-shot cot answer extraction.
create_zero_shot_cot_reasoning_extraction_prompt(text)Create a prompt for zero-shot cot reasoning extraction.
fill_system_prompt_template(...)Fill the system prompt template with the property and classes.
internal_classify_text(text, ...)Internal method to classify the text.

internal_classify_text

internal_classify_text(text: str, current_property: Property, classes: List[str]) Tuple[str, str]

Internal method to classify the text. :param text: The text to classify. :param current_property: The current property to classify the text under. :param classes: The classes to classify the text under.

Returns: The classification result and raw response.