Allow for configurable ranking server url. Delete old ragas call

This commit is contained in:
William Jeynes
2026-04-02 13:48:15 +01:00
parent 7e37a22058
commit 7e586fe17d
4 changed files with 11 additions and 28 deletions
+1
View File
@@ -4,3 +4,4 @@ LANGSMITH_API_KEY=123456
LANGSMITH_ENDPOINT=https://eu.api.smith.langchain.com LANGSMITH_ENDPOINT=https://eu.api.smith.langchain.com
SCRAPER_INSTANCE=https://example.com SCRAPER_INSTANCE=https://example.com
SCRAPER_PARAM_ANYTHING=else SCRAPER_PARAM_ANYTHING=else
RANKING_URL=http://localhost:8000/evaluate
+1 -1
View File
@@ -1,4 +1,4 @@
import { HumanMessage, SystemMessage } from "@langchain/core/messages"; import { SystemMessage } from "@langchain/core/messages";
import { GraphNode } from "@langchain/langgraph"; import { GraphNode } from "@langchain/langgraph";
import { MessagesState } from "../state"; import { MessagesState } from "../state";
import { ChatOllama } from "@langchain/ollama"; import { ChatOllama } from "@langchain/ollama";
+8 -4
View File
@@ -7,7 +7,7 @@ export async function evaluateWithEnsemble({
answer: string; answer: string;
method: string method: string
}): Promise<{ validProb: number; invalidProb: number; }> { }): 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, answer,
method method
}, {timeout: 0}); }, {timeout: 0});
@@ -18,11 +18,15 @@ export async function evaluateWithEnsemble({
return {validProb, invalidProb}; return {validProb, invalidProb};
} }
// let res = await evaluateWithRoberta({answer: "High-profile political downplaying of COVID-19 (examples: President Trump saying 'it will go away' in MarchAugust 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 MarchAugust 2020)"});
// console.log(res) // console.log(res)
// res = await evaluateWithRoberta({answer: "Multiple mirrored reuploads (20202023) 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 (20202023) put the clip on other channels with titles implying it was a genuine 1970s public information film."});
// console.log(res) // console.log(res)
// res = await evaluateWithRoberta({answer: "The COVID-19 Pandemic"}); // res = await evaluateWithEnsemble({method:"logreg" ,answer: "The COVID-19 Pandemic"});
// console.log(res) // console.log(res)
-22
View File
@@ -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)