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

Function union

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

Get the union of two variables :param variable1: a variable :param variable2: a variable :return: a list of union

(variable1: set, variable2: set, sparql_executor)

Source from the content-addressed store, hash-verified

122
123
124def union(variable1: set, variable2: set, sparql_executor): # will create a new variable
125 """
126 Get the union of two variables
127 :param variable1: a variable
128 :param variable2: a variable
129 :return: a list of union
130 """
131 if variable1.type != variable2.type:
132 raise ValueError("union: two variables must have the same type")
133
134 if not isinstance(variable1, Variable) or not isinstance(variable2, Variable):
135 raise ValueError("union: variable must be a variable")
136
137 rtn_str = f"Observation: variable ##, which are instances of {variable1.type}"
138 new_variable = Variable(variable1.type, f"(OR {variable1.program} {variable2.program})")
139 return new_variable, rtn_str
140
141
142def count(variable: Variable, sparql_executor):

Callers

nothing calls this directly

Calls 1

VariableClass · 0.85

Tested by

no test coverage detected