MCPcopy Create free account
hub / github.com/cortexkit/magic-context / loadResultsMap

Function loadResultsMap

packages/plugin/scripts/longmemeval/runner.ts:205–222  ·  view source on GitHub ↗
(resultsFile: string)

Source from the content-addressed store, hash-verified

203}
204
205async function loadResultsMap(resultsFile: string): Promise<Map<string, QuestionResultRecord>> {
206 try {
207 const content = await readFile(resultsFile, "utf8");
208 const map = new Map<string, QuestionResultRecord>();
209 for (const line of content.split(/\r?\n/)) {
210 if (!line.trim()) continue;
211 const parsed = JSON.parse(line) as QuestionResultRecord;
212 map.set(parsed.question_id, parsed);
213 }
214 return map;
215 } catch (error) {
216 const typed = asError(error);
217 if ((typed as NodeJS.ErrnoException).code === "ENOENT") {
218 return new Map();
219 }
220 throw typed;
221 }
222}
223
224async function loadState(config: RunnerConfig): Promise<RunnerStateFile> {
225 if (!config.resume) {

Callers 1

mainFunction · 0.85

Calls 2

setMethod · 0.80
asErrorFunction · 0.70

Tested by

no test coverage detected