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

Function check_context_limit

src/client/agents/http_agent.py:138–161  ·  view source on GitHub ↗
(content: str)

Source from the content-addressed store, hash-verified

136
137
138def check_context_limit(content: str):
139 content = content.lower()
140 and_words = [
141 ["prompt", "context", "tokens"],
142 [
143 "limit",
144 "exceed",
145 "max",
146 "long",
147 "much",
148 "many",
149 "reach",
150 "over",
151 "up",
152 "beyond",
153 ],
154 ]
155 rule = AndRule(
156 [
157 OrRule([ContainRule(word) for word in and_words[i]])
158 for i in range(len(and_words))
159 ]
160 )
161 return rule.check(content)
162
163
164class HTTPAgent(AgentClient):

Callers 1

inferenceMethod · 0.85

Calls 4

checkMethod · 0.95
AndRuleClass · 0.85
OrRuleClass · 0.85
ContainRuleClass · 0.85

Tested by

no test coverage detected