There are multiple places where we iterate over the competitors argument in this validator. When we do, we should be ignoring the case by lowering or uppering both the standard and the basis.
Take this example:
guard = Guard().use(CompetitorCheck(competitors=["Apple"], use_local=True, on_fail="fix"))
resp = guard.validate(llm_output='Fun fact about Apple is that apple is both a fruit and company. Apples come in many different colors and flavors. What if apple is a tech company that makes phones, computers, and tablets? Apple is headquartered in Cupertino, California.')
The model correctly identifies the first uppercase Apple, the second lowercase apple (as in What if apple is a tech company), and the third uppercase Apple as entities within the text. However, since we are not controlling for case, only the uppercase entities are filtered in the output.
There are multiple places where we iterate over the competitors argument in this validator. When we do, we should be ignoring the case by lowering or uppering both the standard and the basis.
Take this example:
The model correctly identifies the first uppercase
Apple
, the second lowercaseapple
(as inWhat if apple is a tech company
), and the third uppercaseApple
as entities within the text. However, since we are not controlling for case, only the uppercase entities are filtered in the output.