Skip to content

[bug] sensitiveTopic throws error #1193

Closed as not planned
Closed as not planned
@railsstudent

Description

@railsstudent

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions