Add removing of duplicates from pipeline. Add to sort step. Move score logic to robertaMetrics node.
This commit is contained in:
+6
-2
@@ -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));
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user