MCPcopy
hub / github.com/openai/evals / __call__

Method __call__

evals/elsuite/bugged_tools/tools.py:205–226  ·  view source on GitHub ↗
(self, tool_task_state: ToolTaskState)

Source from the content-addressed store, hash-verified

203 _input_type = int
204
205 def __call__(self, tool_task_state: ToolTaskState) -> ToolResult:
206 n = tool_task_state.messages[-1].content
207 n = try_cast_from_str(n, int)
208 if n is None:
209 return None
210
211 if n <= 1:
212 return ToolResult(-1)
213
214 maxPrime = -1
215 while n % 2 == 0:
216 maxPrime = 2
217 n >>= 1
218 for i in range(3, int(n**0.5) + 1, 2):
219 while n % i == 0:
220 maxPrime = i
221 n = n / i
222 if n > 2:
223 maxPrime = n
224
225 maxPrime = int(maxPrime)
226 return ToolResult(maxPrime)
227
228
229class IsPronic(Tool):

Callers

nothing calls this directly

Calls 2

try_cast_from_strFunction · 0.90
ToolResultClass · 0.85

Tested by

no test coverage detected