judgeval
v1.0.1
Published
JavaScript/TypeScript client for Judgment evaluation platform
Readme
Judgeval TypeScript SDK
Installation
Find the latest version on npm.
npm install judgevalUsage
Tracer
import { Tracer } from "judgeval";
const tracer = await Tracer.init({
projectName: "my-llm-app",
});
async function chatWithUser(userMessage: string): Promise<string> {
const response = await openai.chat.completions.create({
model: "gpt-4o-mini",
messages: [{ role: "user", content: userMessage }],
});
return response.choices[0].message.content || "";
}
const tracedChat = Tracer.observe(chatWithUser);
const result = await tracedChat("What is the capital of France?");
await Tracer.shutdown();Async Evaluation
Trigger server-side evaluation on the current span:
import { Tracer } from "judgeval";
const tracedChat = Tracer.observe(async (userMessage: string) => {
const response = await openai.chat.completions.create({
model: "gpt-4o-mini",
messages: [{ role: "user", content: userMessage }],
});
Tracer.asyncEvaluate({ judge: "Relevancy" });
return response.choices[0].message.content || "";
});
await tracedChat("What is the capital of France?");Documentation
License
Apache 2.0
