npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@eva-llm/llm-as-a-jest

v0.1.2

Published

Jest plugin with LLM-as-a-Judge matchers basing on G-Eval and LLM-Rubric

Readme

llm-as-a-jest

A Jest plugin for evaluating agent or LLM-generated answers using LLM-based criteria matchers. This package is ideal for testing agentic systems, chatbots, or any AI-generated responses where correctness, relevance, and safety are important.

Features

  • gEval matcher: Evaluate responses using a prompt and multiple criteria.
  • llmRubric matcher: Score responses against a rubric of criteria.
  • Customizable LLM provider, model, threshold, and temperature.

Installation

npm install @eva-llm/llm-as-a-jest
# or
pnpm add @eva-llm/llm-as-a-jest

Usage

Add the setup file to your Jest configuration:

{
  "setupFilesAfterEnv": ["<rootDir>/jest.setup.ts"]
}

Example: Validating Agent Answers

Suppose you have an agent that answers questions. You can test its output like this:

await expect('Paris is the capital of France.').gEval({
  prompt: 'What is the capital of France?',
  criteria: [
    'the answer should be relevant to the question',
    'the answer should be factually correct',
    'the answer should be coherent and understandable',
    'the answer should not contain harmful or inappropriate content',
  ],
});

await expect('Paris is the capital of France.').llmRubric({
  criteria: [
    'the answer should be factually correct',
    'the answer should be coherent and understandable',
    'the answer should not contain harmful or inappropriate content',
  ],
});

Agentic Testing Example

You can use these matchers to test agentic workflows, such as multi-step reasoning or tool use:

const prompt = 'Summarize the main points of the following article...';
const agentAnswer = await agent.run(prompt);

await expect(agentAnswer).gEval({
  prompt,
  criteria: [
    'the summary should capture all main points',
    'the summary should be concise and clear',
    'the summary should not contain hallucinated facts',
  ],
});

When to Use

  • Testing LLM or agent answers for factuality, relevance, and safety
  • Automated evaluation of chatbot or agentic system outputs
  • Ensuring your AI system meets quality standards

License

MIT

LLM Providers and Settings

The list of supported LLM providers and their configuration details are available in the README of the @eva-llm/eva-judge package. Please refer there for up-to-date provider names, model options, and environment variable requirements.

GEvalOptions and LLMRubricOptions

Both matchers accept options objects to customize evaluation:

  • GEvalOptions

    • prompt (string): The prompt/question to evaluate against. (required)
    • criteria (string | string[]): Criteria or rubric for evaluation. (required)
    • threshold (number, optional): Pass threshold (default: pluginConfig.threshold).
    • temperature (number, optional): LLM temperature (default: pluginConfig.temperature).
    • provider (string, optional): LLM provider to use (default: pluginConfig.provider).
    • model (string, optional): LLM model to use (default: pluginConfig.model).
  • LLMRubricOptions

    • criteria (string | string[]): Criteria or rubric for evaluation. (required)
    • threshold (number, optional): Pass threshold (default: pluginConfig.threshold).
    • temperature (number, optional): LLM temperature (default: pluginConfig.temperature).
    • provider (string, optional): LLM provider to use (default: pluginConfig.provider).
    • model (string, optional): LLM model to use (default: pluginConfig.model).

Default Plugin Configuration

You can override the default plugin configuration using the configure function. The defaults are:

{
  provider: 'openai',
  model: 'gpt-4.1-mini',
  threshold: 0.5,
  temperature: 0.0, // Recommended for judging
}

Call configure({ ... }) in your setup to change these values globally for all matchers.