import { TraceloopClient } from "../traceloop-client"; import { BaseDatasetEntity } from "../dataset/base-dataset"; import type { EvaluatorRunOptions, TriggerEvaluatorRequest, TriggerEvaluatorResponse, CreateCustomEvaluatorRequest, EvaluatorUpdateRequest, EvaluatorExecuteOptions, EvaluatorCreateResponse, EvaluatorUpdateResponse, EvaluatorExecuteResponse, EvaluatorSource, EvaluatorCatalogItem, EvaluatorData } from "../../interfaces/evaluator.interface"; import type { ExecutionResponse } from "../../interfaces/experiment.interface"; export declare class Evaluator extends BaseDatasetEntity { constructor(client: TraceloopClient); /** * Creates a new LLM-as-a-judge custom evaluator without binding it to any project or environment. * @param options The evaluator configuration including name, messages, provider, model, and schemas * @returns The created evaluator's ID and slug * @throws Error if the API request fails * * @example * const result = await client.evaluator.create({ * name: "Quality Evaluator", * provider: "openai", * model: "gpt-4o", * messages: [ * { role: "system", content: "You are a strict quality evaluator." }, * { role: "user", content: "Evaluate: {{text}}" }, * ], * inputSchema: [{ name: "text", type: "string" }], * outputSchema: [{ name: "passed", type: "boolean" }], * }); * console.log(result.id, result.slug); */ create(options: CreateCustomEvaluatorRequest): Promise; /** * Lists all evaluators for the organization, optionally filtered by source. * @param source Optional filter — "custom" for user-created evaluators, "prebuilt" for Traceloop built-in evaluators, omit to get all * @returns Array of evaluators with their metadata and schemas * @throws Error if the API request fails or if an invalid source is provided * * @example * // Get all evaluators * const all = await client.evaluator.list(); * * @example * // Get only custom evaluators * const custom = await client.evaluator.list("custom"); */ list(source?: EvaluatorSource): Promise; /** * Retrieves the full configuration of a single evaluator by ID or slug. * @param identifier The evaluator's ID (e.g. "cmb6nr...") or slug (e.g. "my-quality-evaluator") * @returns Full evaluator details including config, provider, model, messages, and schemas * @throws Error if the evaluator is not found or if the config is missing required fields * * @example * // Get by ID * const evaluator = await client.evaluator.get("cmb6nr..."); * * @example * // Get by slug * const evaluator = await client.evaluator.get("my-quality-evaluator"); * console.log(evaluator.provider, evaluator.model); */ get(identifier: string): Promise; /** * Partially updates a custom evaluator. Only the fields you provide are changed. * To update the LLM config (provider, model, messages, etc.), pass the full config object — it replaces the existing one. * @param identifier The evaluator's ID or slug * @param patch The fields to update — all fields are optional, but at least one must be provided * @returns The updated evaluator's ID * @throws Error if the evaluator is not found, if no fields are provided, or if the API request fails * * @example * // Update name only * await client.evaluator.update("my-quality-evaluator", { name: "Updated Name" }); * * @example * // Update config and schemas * await client.evaluator.update("cmb6nr...", { * provider: "anthropic", * model: "claude-3-5-sonnet", * messages: [{ role: "user", content: "Evaluate: {{text}}" }], * inputSchema: [{ name: "text", type: "string" }], * outputSchema: [{ name: "passed", type: "boolean" }], * }); */ update(identifier: string, patch: EvaluatorUpdateRequest): Promise; /** * Runs an evaluator synchronously with the given input and returns the result. * The input keys must match the evaluator's input schema. * @param identifier The evaluator's ID or slug * @param options The execution options containing the input values * @returns The execution result shaped according to the evaluator's output schema * @throws Error if the evaluator is not found, if the input is empty, or if the API request fails * * @example * const result = await client.evaluator.run("my-quality-evaluator", { * input: { text: "The sky is blue because of Rayleigh scattering." }, * }); * console.log(result.result); // { passed: true, reason: "Factually accurate." } */ run(identifier: string, options: EvaluatorExecuteOptions): Promise; private validateIdentifier; private buildPayload; private toEvaluatorData; /** * Run evaluators on experiment task results and wait for completion */ runExperimentEvaluator(options: EvaluatorRunOptions): Promise; /** * Trigger evaluator execution without waiting for results */ triggerExperimentEvaluator(request: TriggerEvaluatorRequest): Promise; /** * Wait for execution result via stream URL (actually JSON endpoint) */ waitForResult(executionId: string, streamUrl: string): Promise; /** * Validate evaluator run options */ private validateEvaluatorOptions; /** * Create InputSchemaMapping from input object */ private createInputSchemaMapping; } //# sourceMappingURL=evaluator.d.ts.map