@assay-ai/jest
v1.3.1-beta
Published
Jest integration for the Assay LLM evaluation framework
Readme
@assay-ai/jest
Custom Jest matchers for LLM evaluation with Assay
Documentation · Metrics · API Reference
Installation
pnpm add -D @assay-ai/core @assay-ai/jest # pnpm
npm install -D @assay-ai/core @assay-ai/jest # npm
yarn add -D @assay-ai/core @assay-ai/jest # YarnQuick Start
// jest.setup.ts
import { setupAssayMatchers } from "@assay-ai/jest";
setupAssayMatchers();// chatbot.eval.ts
describe("Customer Support Chatbot", () => {
it("answers are relevant", async () => {
await expect({
input: "What is your return policy?",
actualOutput: "You can return items within 30 days of purchase.",
retrievalContext: [
"Our return policy allows returns within 30 days of purchase.",
],
}).toBeRelevant({ threshold: 0.8 });
});
it("does not hallucinate", async () => {
await expect({
input: "What is your return policy?",
actualOutput: "You can return items within 30 days of purchase.",
context: [
"Our return policy allows returns within 30 days of purchase.",
],
}).toNotHallucinate();
});
});