Allow multiple source CSV files for normalisation. Implement real model node. Add normalizarion prompt. Implement normalization setup. Start on RAG retreival functions

This commit is contained in:
William Jeynes
2026-02-09 16:32:40 +00:00
parent 8eaa7bfbff
commit 02eac0f553
9 changed files with 311 additions and 56 deletions
+24 -21
View File
@@ -1,24 +1,27 @@
// import { SystemMessage } from "@langchain/core/messages";
// import { GraphNode } from "@langchain/langgraph";
// import { MessagesState } from "../state";
// import { arithmeticTools } from "../tools/arithmetic";
// import { ChatOpenAI } from "@langchain/openai"
import { HumanMessage, SystemMessage } from "@langchain/core/messages";
import { GraphNode } from "@langchain/langgraph";
import { MessagesState } from "../state";
import { ChatOpenAI } from "@langchain/openai"
import { hydratePrompt } from "../prompts/hydratePrompt";
// const model = new ChatOpenAI({
// model: "gpt-5-mini"
// });
export function createModelNode(tools: any, promptPath: string): GraphNode<typeof MessagesState> {
return async (state) => {
const sysPrompt = hydratePrompt(promptPath, state.disinformationTitle)
// const modelWithTools = model.bindTools(arithmeticTools);
const model = new ChatOpenAI({
model: "gpt-5-mini"
});
const modelWithTools = model.bindTools(tools);
// export const llmCall: GraphNode<typeof MessagesState> = async (state) => {
// const response = await modelWithTools.invoke([
// new SystemMessage(
// "You are a helpful assistant tasked with performing arithmetic on a set of inputs. Any calculation, no matter how trivial, should be done with tools. Output the final answer with %%% on each side"
// ),
// ...state.messages,
// ]);
// return {
// messages: [response],
// llmCalls: 1,
// };
// };
const response = await modelWithTools.invoke([
new SystemMessage(
sysPrompt
),
...state.messages,
]);
return {
messages: [response]
};
};
}