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

Method get_data

AgentBench.old/src/tasks/dbbench/__init__.py:143–159  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

141 return conn._cmysql.escape_string(string).decode("utf-8")
142
143 def get_data(self) -> Dataset[Dict, str]:
144 dataset = Dataset()
145 with open(self.data_file) as f:
146 if self.data_file.endswith("json"):
147 data = json.loads(f.read())
148 else:
149 data = [json.loads(line) for line in f.readlines()]
150
151 for entry in data:
152 if entry["type"][0] in ("INSERT", "DELETE", "UPDATE"):
153 ans = entry.pop("answer_md5")
154 else:
155 ans = entry.pop("label")
156 inp = entry
157 dataset.append(DataPiece(inp, ans))
158
159 return dataset
160
161 def predict_single(self, session: Session, data_item: Dict) -> Dict[str, Any]:
162 ctx = mp.get_context('spawn')

Callers

nothing calls this directly

Calls 2

DatasetClass · 0.90
DataPieceClass · 0.90

Tested by

no test coverage detected