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

Function hashAndSaveDatasetEntryOutput

app/src/server/utils/nodes/hashNode.ts:98–123  ·  view source on GitHub ↗
({
  projectId,
  output,
  outputTokens,
  trx = kysely,
}: {
  projectId: string;
  output: ChatCompletionMessage;
  outputTokens?: number;
  trx?: typeof kysely;
})

Source from the content-addressed store, hash-verified

96};
97
98export const hashAndSaveDatasetEntryOutput = async ({
99 projectId,
100 output,
101 outputTokens,
102 trx = kysely,
103}: {
104 projectId: string;
105 output: ChatCompletionMessage;
106 outputTokens?: number;
107 trx?: typeof kysely;
108}) => {
109 const outputHash = hashDatasetEntryOutput({ projectId, output });
110
111 await trx
112 .insertInto("DatasetEntryOutput")
113 .values({
114 projectId,
115 hash: outputHash,
116 output: JSON.stringify(output),
117 outputTokens,
118 })
119 .onConflict((oc) => oc.columns(["hash"]).doNothing())
120 .execute();
121
122 return outputHash;
123};

Callers 2

createNodeEntryFunction · 0.90
generateEntryFunction · 0.90

Calls 1

hashDatasetEntryOutputFunction · 0.85

Tested by 1

createNodeEntryFunction · 0.72