Skip to content

ModelVerbalizer

relationalai.agent.cortex.verbalize
ModelVerbalizer(model: relationalai.semantics.Model)

Default verbalizer that returns relationship readings from a RAI Model.

Extracts relationship readings from a RAI Model and returns them as sorted, newline-separated text. This provides a concise overview of the model’s semantic relationships.

  • model

    (Model) - RAI Model to verbalize.
>>> model = rai.Model("jaffle")
>>> verbalizer = ModelVerbalizer(model)
>>> print(verbalizer.explain_model())
Customer has many Orders
Order has one Customer
ModelVerbalizer.explain_model() -> str

Return sorted, newline-separated relationship readings from the model.

Returns:

  • str - Sorted relationship readings, one per line.
ModelVerbalizer.explain_concept(concept: str) -> str

Return a generic message since all concepts are explained at the model level.

Parameters:

  • concept

    (str) - The name of the concept to explain.

Returns:

  • str - A message indicating that concepts are explained in the model verbalization.
ModelVerbalizerVerbalizerabc.ABC