Evaluate a version or the working set
POST /v1/knowledge-bases/{knowledge_base_id}/evaluations
| Property | Value |
|---|---|
| Operation | create_knowledge_evaluation |
| Group | Knowledge bases |
| Scope | knowledge:write |
| Route class | control |
| Idempotency | Idempotency-Key accepted: a retry with the same key replays the first answer |
| Audit | Audited knowledge.evaluation.create (mutation) |
| Released in | 1.53.0 |
| Phase 0 host | Served (the hosted api pins 1.65.0) |
Runs the corpus through the search path against a version or, when version is omitted, the working set, as a knowledge.evaluation job, and answers 202 with the Evaluation queued, its job_id and its Location (1.53.0; knowledge-bases.md section 10). A request while an Evaluation of the same target is queued or running answers that one. An empty corpus is 422 validation_failed with knowledge_corpus_empty; a version that does not exist is not_found and a retired one knowledge_base_version_retired. The job emits job.succeeded or job.failed.
Request
Set VOCAL_API to the base URL of your API and VOCAL_API_KEY to an API key with the knowledge:write scope (Authentication and keys). Replace each placeholder, such as agt_... or <name>, with your own value.
curl -X POST "$VOCAL_API/v1/knowledge-bases/kb_.../evaluations" \
-H "Authorization: Bearer $VOCAL_API_KEY" \
-H "Idempotency-Key: $(uuidgen)" \
-H "Content-Type: application/json" \
-d '{}'const response = await fetch(`${process.env.VOCAL_API}/v1/knowledge-bases/kb_.../evaluations`, {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.VOCAL_API_KEY}`,
'Idempotency-Key': crypto.randomUUID(),
'Content-Type': 'application/json',
},
body: JSON.stringify({}),
});
console.log(response.status, await response.text());import os
import uuid
import requests
response = requests.post(
f"{os.environ['VOCAL_API']}/v1/knowledge-bases/kb_.../evaluations",
headers={
"Authorization": f"Bearer {os.environ['VOCAL_API_KEY']}",
"Idempotency-Key": str(uuid.uuid4()),
},
json={},
)
print(response.status_code, response.text)Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
knowledge_base_id | path | KnowledgeBaseId | yes | The id of a Knowledge base: kb_ and the row's UUIDv7 in 26 Crockford base32 characters. Opaque and safe to log. |
idempotency-key | header | string | no | A client-chosen key, kept 24 hours per Organization, environment and route. A replay returns the stored response. |
Request body
Content type application/json, required: KnowledgeEvaluationCreateRequest.
| Field | Type | Required | Description |
|---|---|---|---|
top_k | integer | no | The target's retrieval_defaults.top_k when omitted. |
version | KnowledgeVersionTarget | no | The working set when omitted, which is what a publish reads. |
Responses
| Status | Content type | Shape | Error codes |
|---|---|---|---|
202 | application/json | KnowledgeEvaluation | |
400 | application/json | ErrorEnvelope | invalid_request |
401 | application/json | ErrorEnvelope | unauthenticated |
403 | application/json | ErrorEnvelope | forbidden, org_suspended |
404 | application/json | ErrorEnvelope | not_found |
409 | application/json | ErrorEnvelope | knowledge_base_archived, idempotency_in_progress, idempotency_key_reused, knowledge_base_version_retired |
422 | application/json | ErrorEnvelope | validation_failed |
429 | application/json | ErrorEnvelope | rate_limited |
500 | application/json | ErrorEnvelope | internal_error |
Fields of the 202 answer
The shape is KnowledgeEvaluation.
| Field | Type | Required | Description |
|---|---|---|---|
baseline | KnowledgeEvaluationBaseline or null | yes | Null when no version is active or the active one has no completed Evaluation, so no relative check applied. |
corpus_sha256 | string | yes | The digest of the ids and revisions of the corpus queries it ran. |
created_at | Timestamp | yes | |
created_by | ActorRef or null | yes | Who asked for it; null when an automatic publish ran it after a sync. |
error_code | string or null | yes | Why it failed, such as embedding_failed; null otherwise. |
failing_checks | array of KnowledgeGateCheck | yes | The checks the metrics fail, also when the outcome is advisory. |
finished_at | Timestamp or null | yes | |
gate | KnowledgeGateOutcome or null | yes | passed, failed or advisory once completed (knowledgeGateOutcome); null before. |
id | KnowledgeEvaluationId | yes | |
job_id | JobId | yes | The knowledge.evaluation job that runs it. |
knowledge_base_id | KnowledgeBaseId | yes | |
manifest_sha256 | string | yes | The digest of the Document revisions and configuration it searched; a publish compares it with the working set. |
metrics | KnowledgeEvaluationMetrics or null | yes | Null until completed. |
object | "knowledge_evaluation" | yes | |
results | array of KnowledgeEvalResult | yes | |
started_at | Timestamp or null | yes | |
status | KnowledgeEvaluationStatus | yes | |
thresholds | KnowledgeGateThresholds | yes | |
top_k | integer | yes | |
version | integer or null | yes | The version evaluated; null for the working set. |