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
# Import Guard and Validatorfromguardrails.hubimportRestrictToTopicfromguardrailsimportGuard# Setup Guardguard=Guard().use(
RestrictToTopic(
valid_topics=["sports"],
invalid_topics=["music"],
disable_classifier=True,
disable_llm=False,
on_fail="exception"
)
)
guard.validate("""In Super Bowl LVII in 2023, the Chiefs clashed with the Philadelphia Eagles in a fiercely contested battle, ultimately emerging victorious with a score of 38-35.""") # Validator passesguard.validate("""The Beatles were a charismatic English pop-rock band of the 1960s.""") # Validator fails
I am getting below error
ImportError: cannot import name 'RestrictToTopic' from 'guardrails.hub' (/usr/local/lib/python3.10/dist-packages/guardrails/hub/__init__.py)
The text was updated successfully, but these errors were encountered:
I am trying to run readme code of python after installing it like this
then run the code example
I am getting below error
The text was updated successfully, but these errors were encountered: