Allow for configurable ranking server url. Delete old ragas call
This commit is contained in:
@@ -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,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";
|
||||||
|
|||||||
@@ -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 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)
|
// 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)
|
// 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)
|
||||||
@@ -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)
|
|
||||||
Reference in New Issue
Block a user