Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Implementation:Promptfoo Promptfoo Remote Grading

From Leeroopedia
Knowledge Sources
Domains Grading, Remote_API
Last Updated 2026-02-14 07:45 GMT

Overview

Concrete tool for sending assertion/grading payloads to Promptfoo's remote API for server-side evaluation of complex assertions.

Description

The Remote_Grading module (remoteGrading.ts) provides the doRemoteGrading() function that sends grading payloads to the promptfoo remote generation endpoint. This is used for assertion types that require server-side processing, such as certain LLM-based grading tasks. The function attaches the user email for tracking, uses the cached fetch system, and returns a GradingResult with pass/fail, score, reason, and token usage.

Usage

Called by the assertion grading system when an assertion type requires remote evaluation.

Code Reference

Source Location

Signature

export async function doRemoteGrading(
  payload: RemoteGradingPayload,
): Promise<Omit<GradingResult, 'assertion'>>

Import

import { doRemoteGrading } from './remoteGrading';

I/O Contract

Inputs

Name Type Required Description
payload RemoteGradingPayload Yes Object with task field and additional grading data

Outputs

Name Type Description
result GradingResult (partial) Object with pass, score, reason, tokensUsed

Usage Examples

import { doRemoteGrading } from './remoteGrading';

const result = await doRemoteGrading({
  task: 'moderation',
  prompt: 'test prompt',
  output: 'model response',
});

console.log(result.pass);   // true/false
console.log(result.score);  // 0.0-1.0
console.log(result.reason); // 'Explanation of grading'

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment