Skip to main content

KYAI Evaluation

Private Stack Exposure

Remote benchmark workers must reach the Metrum Insights control plane over a public URL. When you run a private or local stack, expose PostgREST before launch and use the public HTTPS URL for METRUM_PUBLIC_API_URL, INSIGHTS_API_URL, and INSIGHTS_CONTROL_PLANE_URL:

cloudflared tunnel --url http://localhost:${POSTGREST_PORT:-3000}
export METRUM_PUBLIC_API_URL="https://<cloudflared-host>.trycloudflare.com"
export INSIGHTS_API_URL="$METRUM_PUBLIC_API_URL"
export INSIGHTS_CONTROL_PLANE_URL="$METRUM_PUBLIC_API_URL"
curl -fsS "$METRUM_PUBLIC_API_URL/" >/dev/null

Do not give a remote worker localhost, 127.0.0.1, host.docker.internal, or a private-only DNS name. Keep the tunnel alive through onboarding, polling, result upload, and teardown; expose any private package/WebUI endpoint through a public URL too when the worker downloads artifacts from that stack.

Use this flow for Know Your AI generation and judge evaluation. Do not expose judge API keys or candidate endpoint secrets in docs, logs, or examples.

Set these environment variables for the examples:

export METRUM_API_URL="https://api.<control-plane-domain>"
export METRUM_JWT_TOKEN="<12-hour-db-minted-postgrest-jwt>"
export METRUM_ACCOUNT_ID="<account-uuid>"

Create KYAI Generation Run

Creates a generation job for a candidate endpoint and prompt snapshot.

curl -fsS -X POST "$METRUM_API_URL/rpc/create_kyai_generation_run" \
-H "Authorization: Bearer $METRUM_JWT_TOKEN" \
-H "Content-Type: application/json" \
-d "{
\"p_owner_account_id\":\"$METRUM_ACCOUNT_ID\",
\"p_project_name\":\"kyai-smoke\",
\"p_workload_code\":\"kyai-candidate-workload\",
\"p_scenario_code\":\"quantum-30\",
\"p_job_name\":\"kyai-generation-quantum-30\",
\"p_endpoint_code\":\"candidate-vllm\",
\"p_snapshot_code\":\"quantum-30\",
\"p_num_samples\":30,
\"p_batch_size\":4
}" | jq

Common parameters:

NameRequiredDescription
p_owner_account_idYesAccount UUID that owns the project.
p_project_nameYesProject that owns the KYAI run.
p_workload_codeYesKYAI workload code.
p_scenario_codeYesKYAI scenario code.
p_job_nameYesStable job name.
p_endpoint_codeNoCandidate endpoint override.
p_snapshot_codeNoPrompt/instruction snapshot override.
p_num_samplesNoLimit for smoke or sampled runs.
p_batch_sizeNoGeneration batch size.
p_server_hostnameNoServer hostname override.

Get KYAI Generation Run

Checks generation job state.

curl -fsS -X POST "$METRUM_API_URL/rpc/get_kyai_generation_run" \
-H "Authorization: Bearer $METRUM_JWT_TOKEN" \
-H "Content-Type: application/json" \
-d "{\"p_account_id\":\"$METRUM_ACCOUNT_ID\",\"p_job_id\":123}" | jq

Parameters:

NameRequiredDescription
p_account_idYesAccount UUID for access filtering.
p_job_idYesKYAI generation job id.

Query KYAI Generation Outputs

Returns generated candidate outputs.

curl -fsS "$METRUM_API_URL/v_kyai_generation_outputs?generation_job_id=eq.123&limit=30" \
-H "Authorization: Bearer $METRUM_JWT_TOKEN" | jq

Query parameters:

NameRequiredDescription
generation_job_idYesUse eq.<job_id> to filter to one generation job.
limitNoMaximum outputs to return.

Create KYAI Evaluation Run

Creates a judge evaluation job over generated outputs.

curl -fsS -X POST "$METRUM_API_URL/rpc/create_kyai_judge_run" \
-H "Authorization: Bearer $METRUM_JWT_TOKEN" \
-H "Content-Type: application/json" \
-d "{
\"p_owner_account_id\":\"$METRUM_ACCOUNT_ID\",
\"p_project_name\":\"kyai-smoke\",
\"p_generation_job_id\":123,
\"p_job_name\":\"kyai-judge-quantum-30\",
\"p_judge_config_code\":\"default-judge\"
}" | jq

Parameters:

NameRequiredDescription
p_owner_account_idYesAccount UUID that owns the project.
p_project_nameYesProject name.
p_generation_job_idYesCompleted generation job to score.
p_job_nameYesStable judge job name.
p_judge_config_codeNoJudge configuration code.
p_judge_system_prompt_codeNoJudge system prompt override.
p_server_hostnameNoServer hostname override.

Get KYAI Judge Run And Results

Check judge state and collect scored results.

curl -fsS -X POST "$METRUM_API_URL/rpc/get_kyai_judge_run" \
-H "Authorization: Bearer $METRUM_JWT_TOKEN" \
-H "Content-Type: application/json" \
-d "{\"p_account_id\":\"$METRUM_ACCOUNT_ID\",\"p_job_id\":456}" | jq

curl -fsS "$METRUM_API_URL/kyai_results?evaluation_job_id=eq.456&limit=30" \
-H "Authorization: Bearer $METRUM_JWT_TOKEN" | jq

Parameters:

APIParameterRequiredDescription
get_kyai_judge_runp_account_idYesAccount UUID for access filtering.
get_kyai_judge_runp_job_idYesKYAI judge job id.
kyai_resultsevaluation_job_idYesUse eq.<job_id> to filter to one judge job.
kyai_resultslimitNoMaximum scored rows to return.