Create corrections
Files a correction of one question of one of the org's Kai decisions: the right answer, which must be one of that question's options and not what Kai answered, and why.
POST /v1/decisions/{decision}/corrections
| Address | https://api.hanzo.ai/v1/decisions/{decision}/corrections |
| Method | POST |
| Operation | decisionsCorrect |
| Auth | Authorization: Bearer $HANZO_API_KEY |
Files a correction of one question of one of the org's Kai decisions: the right answer, which must be one of that question's options and not what Kai answered, and why. A decision Kai captured can teach a capability of its question (/v1/capabilities); one made with capture off is kept with state missing and cannot. The org's first correction turns capture on, so its next decisions can teach. Refused: 409 not_wrong when the answer is Kai's own, 409 corrected when the question already has a correction, 404 when the decision captured no such question.
Request
6 fields, body application/json (required).
| Field | In | Type | Required | Description |
|---|---|---|---|---|
decision | path | string | yes | Decision is the decision's id. |
answer | body | string | — | Answer is the right option label; a score's level may be named by its index. |
cohort | body | string | — | Cohort groups corrections the org files together. |
decision | body | string | — | Decision is the decision's id. |
note | body | string | — | Note says why, for the person reading it later. |
question | body | string | — | Question is the question's key. |
Response
| Status | Body | Meaning |
|---|---|---|
201 | Correction | created |
default | problem-details | refused |
201 body — 12 fields.
| Field | In | Type | Always | Description |
|---|---|---|---|---|
answer | body | string | — | Answer is the right answer; Base what Kai answered. |
at | body | integer (int64) | — | |
base | body | string | — | |
by | body | string | — | |
cohort | body | string | — | |
decision | body | string | — | |
id | body | string | — | |
labels | body | string[] | — | |
note | body | string | — | |
question | body | string | — | |
state | body | string | — | State is captured when the decision's state is held and the correction can teach, missing when the decision was made with capture off. |
type | body | string | — |
Failure carries the platform error shape — see Errors.
Examples
hanzo decisions corrections create <decision>import { Configuration, AiApi } from 'hanzoai';
const api = new AiApi(new Configuration({ accessToken: process.env.HANZO_API_KEY }));
const { data } = await api.decisionsCorrect({ decision: 'decision', answer: "<answer>", cohort: "<cohort>" });from hanzoai.cloud import ApiClient, Configuration
from hanzoai.cloud.api import AiApi
client = ApiClient(Configuration(access_token=os.environ["HANZO_API_KEY"]))
result = AiApi(client).decisions_correct(decision='decision', answer="<answer>", cohort="<cohort>")cfg := hanzoai.NewConfiguration()
cfg.AddDefaultHeader("Authorization", "Bearer "+os.Getenv("HANZO_API_KEY"))
client := hanzoai.NewAPIClient(cfg)
resp, _, err := client.AiAPI.DecisionsCorrect(context.Background()).Execute()
if err != nil {
return err
}use hanzo_client::apis::{configuration::Configuration, ai_api};
let mut cfg = Configuration::new();
cfg.bearer_access_token = std::env::var("HANZO_API_KEY").ok();
let result = ai_api::decisions_correct(&cfg, Default::default()).await?;import ai.hanzo.cloud.ApiClient;
import ai.hanzo.cloud.api.AiApi;
ApiClient client = new ApiClient();
client.setBearerToken(System.getenv("HANZO_API_KEY"));
var result = new AiApi(client).decisionsCorrect();curl -X POST https://api.hanzo.ai/v1/decisions/<decision>/corrections \
-H "Authorization: Bearer $HANZO_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"answer": "<answer>",
"cohort": "<cohort>"
}'Tool ai, op decisionsCorrect — POST the JSON-RPC envelope to https://api.hanzo.ai/v1/mcp.
curl -X POST https://api.hanzo.ai/v1/mcp \
-H "Authorization: Bearer $HANZO_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "ai",
"arguments": {
"op": "decisionsCorrect",
"input": {
"decision": "<decision>",
"answer": "<answer>",
"cohort": "<cohort>"
}
}
}
}'