classifier
rule is used to categorize content into predefined classes or topics. This rule is particularly useful for ensuring that the user questions and LLM responses stay on-topic and relevant to the intended context. It can be used to block off-topic content or to guide the LLM to generate content within specific categories.
Parameters:
- type:
classifier
(specifies the rule type) - value: An array of possible topics or categories
- expected: ‘fail’ or ‘pass’ to indicate if it should be violation or not
- threshold: A number between 0 and 1 representing the confidence level for classification (e.g., 0.8 for 80% confidence)