🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

@mastra/evals

Package Overview
Dependencies
Maintainers
1
Versions
838
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install
Package version was removed
This package version has been unpublished, mostly likely due to security reasons
This package has malicious versions linked to the ongoing "Mastra AI framework compromise" supply chain attack.

Affected versions:

1.3.1
View campaign page

@mastra/evals

`@mastra/evals` ships a collection of scoring utilities you can run locally or inside your own evaluation pipelines. These scorers come in two flavors:

unpublished
Source
npmnpm
Version
1.3.1
Version published
Weekly downloads
130K
0.02%
Maintainers
1
Weekly downloads
 
Created
Source

@mastra/evals

@mastra/evals ships a collection of scoring utilities you can run locally or inside your own evaluation pipelines. These scorers come in two flavors:

  • LLM scorers – leverage a judge model (e.g. OpenAI, Anthropic) to rate responses for qualities such as faithfulness or toxicity.
  • Code/NLP scorers – deterministic heuristics (keyword coverage, similarity, etc.) that do not require an external model.

The scorers do not persist results or integrate with Mastra Storage; you decide where and how to record outcomes.

Installation

npm install @mastra/evals

Quick Start

import { createFaithfulnessScorer, createContentSimilarityScorer } from '@mastra/evals/scorers/prebuilt';

const faithfulness = createFaithfulnessScorer({
   model: 'openai/gpt-4o-mini')
});

const similarity = createContentSimilarityScorer({ ignoreCase: true });

const answer = 'Paris is the capital of France.';
const context = ['Paris is the capital of France', 'France is in Europe'];

const faithfulnessScore = await faithfulness.score({ answer, context });

const similarityScore = similarity.score({
   input: context[0],
   output: answer
});

console.log({ faithfulnessScore, similarityScore });

FAQs

Package last updated on 17 Jun 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts