diff --git a/agent/.env.example b/agent/.env.example index c1ca87d..0f79308 100644 --- a/agent/.env.example +++ b/agent/.env.example @@ -3,4 +3,5 @@ LANGSMITH_TRACING=true LANGSMITH_API_KEY=123456 LANGSMITH_ENDPOINT=https://eu.api.smith.langchain.com SCRAPER_INSTANCE=https://example.com -SCRAPER_PARAM_ANYTHING=else \ No newline at end of file +SCRAPER_PARAM_ANYTHING=else +RANKING_URL=http://localhost:8000/evaluate \ No newline at end of file diff --git a/agent/nodes/model.ts b/agent/nodes/model.ts index 2370d34..74bdbe0 100644 --- a/agent/nodes/model.ts +++ b/agent/nodes/model.ts @@ -1,4 +1,4 @@ -import { HumanMessage, SystemMessage } from "@langchain/core/messages"; +import { SystemMessage } from "@langchain/core/messages"; import { GraphNode } from "@langchain/langgraph"; import { MessagesState } from "../state"; import { ChatOllama } from "@langchain/ollama"; diff --git a/agent/tools/ensembleCall.ts b/agent/tools/ensembleCall.ts index 112e1a3..77041db 100644 --- a/agent/tools/ensembleCall.ts +++ b/agent/tools/ensembleCall.ts @@ -7,7 +7,7 @@ export async function evaluateWithEnsemble({ answer: string; method: string }): Promise<{ validProb: number; invalidProb: number; }> { - const res = await axios.post("http://localhost:8000/evaluate", { + const res = await axios.post(process.env.RANKING_URL ?? "http://localhost:8000/evaluate", { answer, method }, {timeout: 0}); @@ -18,11 +18,15 @@ export async function evaluateWithEnsemble({ return {validProb, invalidProb}; } -// let res = await evaluateWithRoberta({answer: "High-profile political downplaying of COVID-19 (examples: President Trump saying 'it will go away' in March–August 2020)"}); +// import dotenv from "dotenv"; + +// dotenv.config(); + +// let res = await evaluateWithEnsemble({method:"flan" ,answer: "High-profile political downplaying of COVID-19 (examples: President Trump saying 'it will go away' in March–August 2020)"}); // console.log(res) -// res = await evaluateWithRoberta({answer: "Multiple mirrored reuploads (2020–2023) put the clip on other channels with titles implying it was a genuine 1970s public information film."}); +// res = await evaluateWithEnsemble({method:"roberta" ,answer: "Multiple mirrored reuploads (2020–2023) put the clip on other channels with titles implying it was a genuine 1970s public information film."}); // console.log(res) -// res = await evaluateWithRoberta({answer: "The COVID-19 Pandemic"}); +// res = await evaluateWithEnsemble({method:"logreg" ,answer: "The COVID-19 Pandemic"}); // console.log(res) \ No newline at end of file diff --git a/agent/tools/ragasCall.ts b/agent/tools/ragasCall.ts deleted file mode 100644 index c420f79..0000000 --- a/agent/tools/ragasCall.ts +++ /dev/null @@ -1,22 +0,0 @@ -import axios from "axios"; - -export async function evaluateWithRagas({ - question, - answer, - contexts, -}: { - question: string; - answer: string; - contexts: string[]; -}) { - const res = await axios.post("http://localhost:8001/evaluate", { - question, - answer, - contexts, - }); - - return res.data; -} - -// let res = await evaluateWithRagas({question: "Who was Bill Nye", answer: "Bill Nye was a Scientist", contexts: ["Bill nye was a Scientist"]}); -// console.log(res) \ No newline at end of file