Skip to content

AiGatewayEvaluation

Source: src/Cloudflare/AiGateway/Evaluation.ts

An evaluation job on a Cloudflare AI Gateway.

Evaluations measure performance (speed, cost, feedback) of the logged traffic captured by one or more datasets on a gateway. They are create-only on Cloudflare’s side: any prop change replaces the evaluation with a fresh job.

const gateway = yield* Cloudflare.AiGateway("Gateway");
const dataset = yield* Cloudflare.AiGatewayDataset("SuccessLogs", {
gatewayId: gateway.gatewayId,
filters: [{ key: "success", operator: "eq", value: [true] }],
});
const types = yield* listEvaluationTypes(gateway.accountId);
const evaluation = yield* Cloudflare.AiGatewayEvaluation("Baseline", {
gatewayId: gateway.gatewayId,
datasetIds: [dataset.datasetId],
evaluationTypeIds: types
.filter((t) => t.mandatory)
.map((t) => t.id),
});