You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
After I instantiated a sensitiveTopic validator and called its validate method, error message was issued.
found_topics = self.get_topics_zero_shot(value, invalid_topics)
AttributeError: 'SensitiveTopic' object has no attribute 'get_topics_zero_shot'
To Reproduce
Steps to reproduce the behavior:
sensitiveTopic = SensitiveTopic(
sensitive_topics=["conspiracy", "food", "entertainment", "politics", "religion", "violence", "hate"],
disable_classifier=False,
disable_llm=True,
on_fail=OnFailAction.EXCEPTION
)
result = sensitiveTopic.validate(value="Large corporations should act responsibly socially and environmentally. They should reduce carbon emission. One way to monitor their behavior is by reading their ESG Report.")
print(result.outcome)
Expected behavior
The guard should return a valid result
Library version:
0.5.2
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered:
Hi @railsstudent, thanks for flagging this. The issue is that the SensitiveTopic validator currently inherits from the RestrictToTopic validator and the get_topics_zero_shot function (as well as a number of other functions) have since been removed/changed.
We are looking into the best way to handle this.
Since SensitiveTopic and RestrictToTopic use the same underlying models to identify topics, you could try using the RestrictToTopic validator and only specifying the off-topic entries which would achieve the same effect. There is a PR here that will allow you to only specify off-topic (sensitive) entries.
Describe the bug
After I instantiated a sensitiveTopic validator and called its
validate
method, error message was issued.To Reproduce
Steps to reproduce the behavior:
Expected behavior
The guard should return a valid result
Library version:
0.5.2
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: