MCPcopy Index your code
hub / github.com/THUDM/AgentBench / argmin

Method argmin

src/server/tasks/knowledgegraph/api.py:191–204  ·  view source on GitHub ↗

Argmin by attribute. Returns (new_variable, "Observation: ...").

(self, variable: Variable, attribute: str)

Source from the content-addressed store, hash-verified

189 return new_variable, rtn_str
190
191 def argmin(self, variable: Variable, attribute: str):
192 """
193 Argmin by attribute. Returns (new_variable, "Observation: ...").
194 """
195 cache_key = (self.task_id, hash(variable))
196 if cache_key not in attribute_cache and variable not in variable_attributes_cache:
197 self.get_attributes(variable)
198
199 if attribute not in variable_attributes_cache.get(variable, []):
200 raise ValueError("argmin: attribute must be an attribute of the variable")
201
202 rtn_str = f"Observation: variable ##, which are instances of {variable.type}"
203 new_variable = Variable(variable.type, f"(ARGMIN {variable.program} {attribute})")
204 return new_variable, rtn_str

Callers

nothing calls this directly

Calls 2

get_attributesMethod · 0.95
VariableClass · 0.85

Tested by

no test coverage detected