MCPcopy Create free account
hub / github.com/THUDM/AgentTuning / argmax

Function argmax

AgentBench.old/src/tasks/knowledgegraph/api.py:175–191  ·  view source on GitHub ↗

Get the argmax of a variable :param variable: a variable :param relation: a relation :return: the argmax of a variable

(variable: str, attribute: str, sparql_executor)

Source from the content-addressed store, hash-verified

173
174
175def argmax(variable: str, attribute: str, sparql_executor):
176 """
177 Get the argmax of a variable
178 :param variable: a variable
179 :param relation: a relation
180 :return: the argmax of a variable
181 """
182 # program = f"(ARGMAX {variable} {attribute})"
183 # processed_code = postprocess_raw_code(program)
184 # sparql_query = lisp_to_sparql(processed_code)
185 # answers = execute_query(sparql_query)
186 if attribute not in variable_attributes_cache[variable]:
187 raise ValueError("argmax: attribute must be an attribute of the variable")
188
189 rtn_str = f"Observation: variable ##, which are instances of {variable.type}"
190 new_variable = Variable(variable.type, f"(ARGMAX {variable.program} {attribute})")
191 return new_variable, rtn_str
192
193
194def argmin(variable: str, attribute: str, sparql_executor):

Callers

nothing calls this directly

Calls 1

VariableClass · 0.85

Tested by

no test coverage detected