MCPcopy Create free account
hub / github.com/THUDM/AgentBench / ContainRule

Class ContainRule

src/utils/rules.py:9–22  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7
8
9class ContainRule(RuleBase):
10 def __init__(self, target, reverse=False) -> None:
11 """
12 Check if target is in obj.
13 `reverse`: if True, check if obj is in target
14 """
15 self.target = target
16 self.reverse = reverse
17
18 def check(self, obj) -> bool:
19 if self.reverse:
20 return obj in self.target
21 else:
22 return self.target in obj
23
24
25class NotRule(RuleBase):

Callers 1

check_context_limitFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected