Skip to Content
Judgment Labs

Judgeval

The main entry point for interacting with the Judgment platform.

Judgeval connects to your Judgment project and gives you access to SQL queries, evaluations, datasets, and monitoring.

import { Judgeval } from "judgeval";

const client = await Judgeval.create({ projectName: "my-project" });

Throws

Error if any required credential is missing.

Static Method

create()

Create a new Judgeval client instance.

Resolves the projectName to a projectId via the Judgment API.

const client = await Judgeval.create({
  projectName: "my-project",
  apiKey: "<your-api-key>",
  organizationId: "<your-organization-id>",
});
async function create(config: JudgevalConfig): Promise<Judgeval>

Parameters

Prop

Type

Returns

Promise<Judgeval> - A new Judgeval instance.


discoverSchema()

Returns the server's SQL reference as Markdown, matching MCP discover_schema: tables, columns, descriptions, examples, and limits. Requires organization viewer access, but no resolved project.

console.log(await client.discoverSchema());
async function discoverSchema(options?: { signal?: AbortSignal; } | undefined): Promise<string>

Parameters

Prop

Type

Returns

Promise<string> - The virtual schema reference as a Markdown string; no project data.


sql()

Runs one read-only SQL SELECT for this organization and project.

The server derives scope from the client's credentials and resolved project. Call discoverSchema() for supported tables and columns. Requires viewer access.

Results are capped at 1,000 rows and 5 MiB; exceeding either cap returns an error. Use SQL predicates and LIMIT to narrow results. Integers outside JavaScript's safe range arrive as exact decimal strings.

const result = await client.sql("SELECT count() AS run_count FROM telemetry.traces");
console.log(result.rows);
async function sql(sql: string, options?: { signal?: AbortSignal; } | undefined): Promise<SqlResponse>

Parameters

Prop

Type

Returns

Promise<SqlResponse> - An object with catalog_version, columns (name, type, nullable), rows (objects keyed by column name), row_count, and elapsed_ms.

On this page