Topic guardrail¶
- class opik.guardrails.guards.topic.Topic(allowed_topics: List[str] | None = None, restricted_topics: List[str] | None = None, threshold: float = 0.5)¶
Bases:
Guard
Guard that validates text against a list of topics.
Can be configured to allow or restrict specific topics.
- get_validation_configs() List[Dict[str, Any]] ¶
Get the validation configuration for topic matching.
- Returns:
List containing the topic validation configuration