Add removing of duplicates from pipeline. Add to sort step. Move score logic to robertaMetrics node.

This commit is contained in:
William Jeynes
2026-03-13 14:51:14 +00:00
parent d5c6cb444d
commit 0a7bb114d2
6 changed files with 105 additions and 7 deletions
+6 -2
View File
@@ -1,10 +1,14 @@
import { GraphNode } from "@langchain/langgraph";
import { MessagesState } from "../state";
import { AIMessage } from "@langchain/core/messages";
import { removeDuplicates } from "../tools/removeDuplicates";
export const sort: GraphNode<typeof MessagesState> = async (state) => {
//not sure which will be better from API, just do both
let current = state.proposedTriggerEvent;
// remove duplicates
await removeDuplicates(current)
// not sure which will be better from API, just do both
current.sort((a, b) => ((b.score as number) ?? 0) - ((a.score as number) ?? 0));