Skip to content

Evaluation

Source: src/Cloudflare/AI/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.AI.Gateway("Gateway");
const dataset = yield* Cloudflare.AI.Dataset("SuccessLogs", {
gatewayId: gateway.gatewayId,
filters: [{ key: "success", operator: "eq", value: [true] }],
});
const types = yield* listEvaluationTypes(gateway.accountId);
const evaluation = yield* Cloudflare.AI.Evaluation("Baseline", {
gatewayId: gateway.gatewayId,
datasetIds: [dataset.datasetId],
evaluationTypeIds: types
.filter((t) => t.mandatory)
.map((t) => t.id),
});