MCPcopy Index your code
hub / github.com/OpenPipe/OpenPipe / getOutputHashes

Function getOutputHashes

app/src/server/tasks/evaluateTestSetEntries.task.ts:559–618  ·  view source on GitHub ↗
({
  nodeEntry,
  modelId1,
  modelId2,
}: {
  nodeEntry: NodeEntry;
  modelId1: string;
  modelId2: string;
})

Source from the content-addressed store, hash-verified

557};
558
559const getOutputHashes = async ({
560 nodeEntry,
561 modelId1,
562 modelId2,
563}: {
564 nodeEntry: NodeEntry;
565 modelId1: string;
566 modelId2: string;
567}) => {
568 const getOutputHash = async ({ modelId }: { modelId: string }) => {
569 if (modelId !== ORIGINAL_MODEL_ID) {
570 return kysely
571 .selectFrom("FineTuneTestingEntry as ftte")
572 .where("ftte.modelId", "=", modelId)
573 .where("ftte.inputHash", "=", nodeEntry.inputHash)
574 .leftJoin("FineTune as ft", "ft.id", "ftte.fineTuneId")
575 .innerJoin("DatasetEntryOutput as deo", "deo.hash", "ftte.outputHash")
576 .select(["ftte.outputHash"])
577 .executeTakeFirst()
578 .then((entry) => entry?.outputHash);
579 } else {
580 return kysely
581 .selectFrom("NodeEntry as ne")
582 .where("ne.id", "=", nodeEntry.id)
583 .select(["ne.outputHash"])
584 .executeTakeFirst()
585 .then((entry) => entry?.outputHash);
586 }
587 };
588
589 // Ensure output has already been generated
590 const [existingFirstOutputHash, existingSecondOutputHash] = await Promise.all([
591 getOutputHash({ modelId: modelId1 }),
592 getOutputHash({ modelId: modelId2 }),
593 ]);
594
595 const generationPromises = [];
596
597 if (!existingFirstOutputHash) {
598 generationPromises.push(
599 generateEntry({
600 modelId: modelId1,
601 nodeEntryId: nodeEntry.id,
602 }),
603 );
604 }
605
606 if (!existingSecondOutputHash) {
607 generationPromises.push(
608 generateEntry({
609 modelId: modelId2,
610 nodeEntryId: nodeEntry.id,
611 }),
612 );
613 }
614
615 await Promise.all(generationPromises);
616

Callers 1

Calls 2

generateEntryFunction · 0.90
getOutputHashFunction · 0.85

Tested by

no test coverage detected