@toloka-platform/sdk 0.21.3 → 0.23.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,95 +0,0 @@
1
- ---
2
- name: toloka-customer-review
3
- description: Set up customer review on Toloka generation nodes and work through the review queue of a run with the toloka CLI, accepting or rejecting tasks with evidence. Only for teams with customer review enabled. Use when the user wants their own team to approve each generation result, asks which tasks wait for their decision, or asks to accept or reject reviewed tasks.
4
- ---
5
-
6
- # Customer review
7
-
8
- Customer review is a quality assurance mode of generation nodes for teams that have it enabled: the customer's own team accepts or rejects every task the node produces.
9
-
10
- Customer review is available only to some teams, and nothing shows in advance whether a team has it. For a team without it, validation, deploy, and every review command answer `403 The "customerReview" feature is not enabled for this team`. Treat that answer as "customer review is not available for this team": stop, tell the user, do not offer the mode again, and if a node of theirs already has it, offer another QA mode.
11
-
12
- ## What the mode does
13
-
14
- - It is set on a generation node as `qualityAssurance: { qaMode: 'customer_review' }`, with no other settings. Quorum nodes do not support it.
15
- - Each item gets one task, nothing is redone, and the team's decision on that task is final for the item.
16
- - Automatic grading is off on such a node: no LLM QA grades its tasks, and no Human QA reviews them. The one automated step left is the **LLM QA check**: every reject that is not forced goes to an LLM, which reads the task, the quality criteria the reject names, and its comment, and answers whether that evidence holds.
17
- - It works with every workforce a generation node supports, including synthetic generation, and with Training and Exam.
18
- - Quality criteria are still required: a reject names the criteria the task fails, and the LLM QA check reads them.
19
-
20
- ## When to suggest it
21
-
22
- Suggest it only when the user wants their own team to approve each result, for example a sign-off, acceptance against their own standard, or a contract that requires it. Never suggest it by default, and never infer it from the quality criteria.
23
-
24
- Before switching a node to it, explain the trade-offs:
25
-
26
- - someone on the team has to decide every task before its deadline, or the task is accepted automatically and billed;
27
- - throughput follows the team's review speed;
28
- - items wait at the node, and the run finishes only after its last review closes.
29
-
30
- ## How a review goes
31
-
32
- - When a task is submitted, its review opens with a deadline for a decision (`deadlineAt`).
33
- - **Accept** is final at once: the expert is paid, the task is billed, and the item moves on to the next node.
34
- - **Reject** names at least one of the review's quality criteria (the IDs that `toloka review get` prints) and explains in a non-empty comment what is wrong. The review then waits for the LLM QA check (`checking`) and refuses decisions until the check answers:
35
- - `agree`: the reject is final. The item fails at this node and is not redone; nothing is billed for the task, and the expert is not paid.
36
- - `disagree`: the evidence does not hold. The review returns (`returned`) with the check's reason; accept the task, or reject again with better evidence.
37
- - `inconclusive`: the check could not decide, for example because its run failed repeatedly or gave no readable answer. The review also returns.
38
- - Each review allows a limited number of checked rejects (`checkedRejectsLeft`). When none are left, accept the task or send a forced reject: the check has returned a reject by then, so the forced reject is allowed.
39
- - **Forced reject** (`--force`) works only through the API and the CLI, never in the UI, and only after the LLM QA check has returned a reject of the same review. A forced reject on a review that has no returned check is a conflict: reject without `--force` first. It still needs criteria and a comment, skips the LLM QA check, is final at once, and does not use up a checked reject.
40
- - Canceling a run does not close its open reviews: they keep waiting for the team's decision and expire at their deadline as usual.
41
-
42
- ## Deadline and expiry
43
-
44
- - From `deadlineAt` on, the review takes no more decisions.
45
- - A review that waits for a decision at its deadline (`needs_review` or `returned`) expires: the task is accepted automatically, the expert is paid, the task is billed, and the item moves on.
46
- - A review that is `checking` at its deadline stays open until the LLM QA check answers. If the check agrees, the reject is final. Otherwise the review expires as above, and nobody can decide it again.
47
- - So `deadlineAt` is when decisions stop, not the exact moment the review closes: an expiry takes effect shortly after the deadline, and a review that is checking closes when the check answers.
48
-
49
- ## Statuses
50
-
51
- - `needs_review`: waits for the first decision.
52
- - `returned`: the LLM QA check did not confirm the last reject (`disagree` or `inconclusive`), so the review waits for a new decision.
53
- - `checking`: the LLM QA check is checking a reject; decisions are refused until it answers.
54
- - `accepted`: the team accepted the task.
55
- - `rejected`: the reject is final, either forced or confirmed by the LLM QA check, and the item failed at this node.
56
- - `expired`: the deadline passed while the review was open, whether it waited for a first decision, was returned, or was checking a reject that the check then did not confirm. The task was accepted automatically.
57
-
58
- ## Billing
59
-
60
- - An accepted task, whether the team accepted it or its review expired, bills the node's per-task price, plus the Training and Exam bonuses when it is the expert's first accepted task. For synthetic generation, it bills that task's generation tokens.
61
- - A finally rejected task bills nothing.
62
- - The LLM QA check is not billed. The cost forecast has no QA line for the node, and its maximum assumes every task is accepted.
63
-
64
- ## Work through the queue
65
-
66
- The team decides in the platform UI (the run's Items tab: open an item, then Review), through the API, or with these commands:
67
-
68
- 1. `toloka review list --run <run-id>` lists the reviews that still take a decision (`needs_review` and `returned` before their deadline), soonest deadline first. `--status checking` and `--status closed` show the other views, `--node <node-id>` keeps one node, and `--json` prints JSON.
69
- 2. `toloka review get <review-id>` shows the review's status and deadline, the quality criteria with their IDs, the decisions so far with the answers of the LLM QA check, and the task content. Project files in the task content appear as file proxy URLs. The output is cut to at most 20 quality criteria, 20 criteria in each decision, 1,000 characters of each text, and 8,000 characters of task content, and it says what it cut. `--out <file>` saves the whole review as JSON; read that file in parts. `--json` prints the same cut view, with the task content as JSON text in `taskContentJson` and a `truncated` summary that is `null` when nothing was cut and otherwise has:
70
- - `taskContentCharacters`: the full length of the task content when it was cut, otherwise `null`;
71
- - `truncatedQualityCriterionCount`: how many quality criteria were left out;
72
- - `truncatedVerdictCriteria`: each decision whose criteria were cut (`field`), with how many were left out (`truncatedCount`);
73
- - `cutTexts`: each cut text (`field`), with its full length (`characters`);
74
- - `hint`: the command that saves the full review.
75
- 3. Decide with `toloka review accept <review-id>`, or `toloka review reject <review-id> --criterion <criterion-id> --comment "<what is wrong>"`. Repeat `--criterion` for each failed criterion. With `--json`, both print the review after the decision in the same cut view as `toloka review get --json`.
76
- 4. A decision moves the review out of the awaiting list, so list again from the start instead of paging forward with `--offset`.
77
-
78
- To accept every review that awaits a decision in a run, or in one node, send one bulk accept instead of a command per review: `toloka review accept --run <run-id> [--node <node-id>] --expected <n>`, where `<n>` is the number of awaiting reviews the user confirmed (the total that `toloka review list` prints). When a different number awaits a decision now, it accepts nothing and says the current number; confirm again with the user. The accepts run in the background, each like a single accept. A review that is decided, rejected, or past its deadline before its turn is skipped, and reviews that open later are not included. Follow the progress with `toloka review list`: accepted reviews leave the awaiting list. There is no bulk reject: reject one review at a time, each with its own evidence.
79
-
80
- When a command fails:
81
-
82
- - `The "customerReview" feature is not enabled for this team`: the team does not have customer review. Stop and tell the user.
83
- - `Scoped token does not allow review:write`: the token can read reviews but not decide them. Every preset except `read` and `labeling-read` includes `review:write`. Tell the user instead of looking for another way to decide.
84
- - A conflict (HTTP 409): the review cannot take the decision now, because the LLM QA check is still checking, the checked rejects are used up, a forced reject came before any returned check, or the review is closed or past its deadline. Run `toloka review get <review-id>` and act on its status.
85
-
86
- ## Decide only when asked
87
-
88
- - Accept or reject only on the user's explicit instruction that names the reviews, or an exact filter such as "the awaiting reviews of node X in run Y". Accepting pays the expert and bills the task at once, and a final reject fails the item; neither can be undone.
89
- - Before a bulk accept or more than one decision, tell the user how many reviews you are about to decide and how, show at most 5 of them as a sample with the decision for each, and get their confirmation. Send a confirmed accept of all of them as one bulk accept with that number as `--expected`.
90
- - Send a forced reject only when the user explicitly asks for one.
91
- - Never decide reviews just to let a run finish.
92
-
93
- ## In pipeline source
94
-
95
- A generation node with customer review has `qualityAssurance: { qaMode: 'customer_review' }`. Keep it as imported unless the user asks to change it.