Skip to content

Knowledge bases

PolicyBase dataclass

PolicyBase(allowed_commitments: frozenset[str] = frozenset(), disallowed_commitment_topics: frozenset[str] = frozenset())

A minimal policy knowledge base.

Attributes:

Name Type Description
allowed_commitments frozenset[str]

Lowercase substrings the bot IS allowed to commit to. If any of these appears in a commitment-containing bot message, the commitment is considered verified.

disallowed_commitment_topics frozenset[str]

Lowercase topic keywords (e.g. "lifetime warranty", "price match") that the bot is explicitly NOT allowed to commit to. A commitment on any of these topics is flagged as a policy violation with higher confidence.

FactBase dataclass

FactBase(facts: dict[str, str] = dict(), aliases: dict[str, tuple[str, ...]] = dict())

A minimal fact knowledge base.

Attributes:

Name Type Description
facts dict[str, str]

Mapping of topic label → ground truth string. The detector searches bot messages for mentions of each topic and flags the message if the ground-truth facts are missing or directly contradicted by a confident bot claim.

aliases dict[str, tuple[str, ...]]

Optional mapping of topic label → list of alternate surface forms. E.g. aliases["store_hours"] = ["opening hours", "hours"].