ontolearn.verbalizer

Classes

LLMVerbalizer

Functions

verbalize_learner_prediction(→ None)

Generate and print multiple verbalized versions of a learner's prediction using an LLM verbalizer.

Module Contents

class ontolearn.verbalizer.LLMVerbalizer(model: str = 'mixtral:8x7b', url: str = 'http://tentris-ml.cs.upb.de:8000/api/generate', api_key: str | None = None)[source]
model = 'mixtral:8x7b'
url = 'http://tentris-ml.cs.upb.de:8000/api/generate'
api_key = None
__call__(text: str)[source]
Parameters:

text – String representation of an OWL Class Expression

ontolearn.verbalizer.verbalize_learner_prediction(prediction: str | object = None, num_predictions: int = 3) None[source]

Generate and print multiple verbalized versions of a learner’s prediction using an LLM verbalizer.

This function takes a prediction (either a string or object), uses an LLMVerbalizer to generate three verbalized responses, and prints them. This is useful for inspecting how the model might rephrase or interpret a given prediction.

Parameters:
  • prediction (Union[str, object]) – The learner’s prediction to verbalize. Must not be None.

  • num_predictions (int) – Number of prediction ouputs from the verbalizer with default value of 3

Raises:

AssertionError – If the prediction is None.