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

Method __call__

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

Source from the content-addressed store, hash-verified

165 _input_type = int
166
167 def __call__(self, tool_task_state: ToolTaskState) -> ToolResult:
168 n = tool_task_state.messages[-1].content
169 n = try_cast_from_str(n, int)
170 if n is None:
171 return None
172
173 count = 0
174 for i in range(1, (int)(math.sqrt(n)) + 1):
175 if n % i == 0:
176 # If divisors are equal, count only one
177 if n / i == i:
178 count = count + 1
179 else: # Otherwise count both
180 count = count + 2
181
182 return ToolResult(count)
183
184
185class SumOfPalindromes(Tool):

Callers

nothing calls this directly

Calls 2

try_cast_from_strFunction · 0.90
ToolResultClass · 0.85

Tested by

no test coverage detected