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

Function getDownstreamDatasets

app/src/server/utils/nodes/relationalQueries.ts:5–38  ·  view source on GitHub ↗
({ monitorFilterNodeId }: { monitorFilterNodeId: string })

Source from the content-addressed store, hash-verified

3import { LLMRelabelOutput } from "./nodeProperties/llmRelabelProperties";
4
5export const getDownstreamDatasets = ({ monitorFilterNodeId }: { monitorFilterNodeId: string }) => {
6 return kysely
7 .selectFrom("Node as filterNode")
8 .where("filterNode.id", "=", monitorFilterNodeId)
9 .innerJoin("NodeOutput as filterNodeOutput", "filterNodeOutput.nodeId", "filterNode.id")
10 .where("filterNodeOutput.label", "=", MonitorOutput.MatchedLogs)
11 .innerJoin("DataChannel as dc", "dc.originId", "filterNodeOutput.id")
12 .innerJoin("Node as monitorLLMRelabelNode", "monitorLLMRelabelNode.id", "dc.destinationId")
13 .innerJoin(
14 "NodeOutput as monitorLLMRelabelNodeOutput",
15 "monitorLLMRelabelNodeOutput.nodeId",
16 "monitorLLMRelabelNode.id",
17 )
18 .where("monitorLLMRelabelNodeOutput.label", "=", LLMRelabelOutput.Relabeled)
19 .innerJoin("DataChannel as dc2", "dc2.originId", "monitorLLMRelabelNodeOutput.id")
20 .innerJoin("Node as datasetLLMRelabelNode", "datasetLLMRelabelNode.id", "dc2.destinationId")
21 .innerJoin(
22 "NodeOutput as datasetLLMRelabelNodeOutput",
23 "datasetLLMRelabelNodeOutput.nodeId",
24 "datasetLLMRelabelNode.id",
25 )
26 .where("datasetLLMRelabelNodeOutput.label", "=", LLMRelabelOutput.Relabeled)
27 .innerJoin("DataChannel as dc3", "dc3.originId", "datasetLLMRelabelNodeOutput.id")
28 .innerJoin("Node as manualRelabelNode", "manualRelabelNode.id", "dc3.destinationId")
29 .innerJoin(
30 "NodeOutput as manualRelabelNodeOutput",
31 "manualRelabelNodeOutput.nodeId",
32 "manualRelabelNode.id",
33 )
34 .innerJoin("DataChannel as dc4", "dc4.originId", "manualRelabelNodeOutput.id")
35 .innerJoin("Node as datasetNode", "datasetNode.id", "dc4.destinationId")
36 .innerJoin("Dataset as d", "d.nodeId", "datasetNode.id")
37 .distinctOn("datasetNode.id");
38};
39
40export const getSourceLLMRelabelNodes = ({
41 datasetManualRelabelNodeId,

Callers 1

monitors.router.tsFile · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected