MCPcopy Create free account
hub / github.com/OpenPipe/OpenPipe / startTestJobsForModel

Function startTestJobsForModel

app/src/server/utils/nodes/startTestJobs.ts:157–193  ·  view source on GitHub ↗
({
  modelId,
  datasetId,
}: {
  modelId: string;
  datasetId: string;
})

Source from the content-addressed store, hash-verified

155
156// Used for both fine-tuned and comparison models
157export const startTestJobsForModel = async ({
158 modelId,
159 datasetId,
160}: {
161 modelId: string;
162 datasetId: string;
163}) => {
164 const dataset = await prisma.dataset.findUniqueOrThrow({
165 where: {
166 id: datasetId,
167 },
168 });
169
170 const nodeEntriesToRun = await kysely
171 .selectFrom("NodeEntry as ne")
172 .innerJoin("DataChannel as dc", (join) =>
173 join.onRef("dc.id", "=", "ne.dataChannelId").on("dc.destinationId", "=", dataset.nodeId),
174 )
175 .where("ne.status", "=", "PROCESSED")
176 .where("ne.split", "=", "TEST")
177 .leftJoin("FineTuneTestingEntry as ftte", (join) =>
178 join.onRef("ftte.inputHash", "=", "ne.inputHash").on("ftte.modelId", "=", modelId),
179 )
180 .where("ftte.id", "is", null)
181 .select(["ne.id as nodeEntryId"])
182 .execute();
183
184 await Promise.all(
185 nodeEntriesToRun.map((nodeEntry) =>
186 generateTestSetEntry.enqueue({
187 modelId,
188 nodeEntryId: nodeEntry.nodeEntryId,
189 numPreviousTries: 0,
190 }),
191 ),
192 );
193};

Callers 3

runOnceFunction · 0.90
startDatasetTestJobsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected