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

Method argmax

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

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

(self, variable: Variable, attribute: str)

Source from the content-addressed store, hash-verified

174 return None, rtn_str
175
176 def argmax(self, variable: Variable, attribute: str):
177 """
178 Argmax by attribute. Returns (new_variable, "Observation: ...").
179 """
180 cache_key = (self.task_id, hash(variable))
181 if cache_key not in attribute_cache and variable not in variable_attributes_cache:
182 self.get_attributes(variable)
183
184 if attribute not in variable_attributes_cache.get(variable, []):
185 raise ValueError("argmax: attribute must be an attribute of the variable")
186
187 rtn_str = f"Observation: variable ##, which are instances of {variable.type}"
188 new_variable = Variable(variable.type, f"(ARGMAX {variable.program} {attribute})")
189 return new_variable, rtn_str
190
191 def argmin(self, variable: Variable, attribute: str):
192 """

Callers 1

process_actionFunction · 0.80

Calls 2

get_attributesMethod · 0.95
VariableClass · 0.85

Tested by

no test coverage detected