Cluster
Group values using a deterministic equivalence predicate.
Cluster groups values whose trusted pairwise predicate says they are equivalent.
Worked example
Cluster(
name="group-normalized-emails",
input_spaces=("contacts",),
output_space="email-clusters",
primary_key="email",
fn=lambda left, right: (
left["email"].strip().lower() == right["email"].strip().lower()
),
)Callable contract
fn(left, right) -> bool.
Rows available to the callable
Each row argument contains the declared primary-key fields and the declared evidence fields available for that input role. If the callable reads a field that is not part of the primary key, declare it as evidence.
| Parameter | Default | Meaning |
|---|---|---|
input_spaces | required | The Space or Spaces read by the task. |
output_space | required | The Space that receives the task output. |
name | required | A stable task name used in sessions, reviews, and metrics. |
primary_key | id | The field, or tuple of fields, that identifies one task input. Duplicate primary-key values are evaluated once. |
evidence | none | Optional fields made available to the callable in addition to the primary key. |
fn | required | A deterministic callable that completely defines the operation's decision. Use an importable named function from your package, or PythonFunction(name=..., source=...) when authoring through the hosted API or node editor. Pairwise endomorphic functions may declare an exact indexed candidate_gate. |
function_parameters | registered defaults | Typed values bound to parameters declared by the registered function. Finite candidate sets let reviewed evidence support parameter advice. |
Output
One component record for every recovered group, including singleton groups.
Design guidance
The predicate should behave like equivalence. Use Union when equality is simply an exact key comparison, and SemCluster when equivalence requires language understanding. For a large candidate-partition prefilter, expose its threshold through the PythonFunction parameter schema and declare an exact indexed candidate_gate such as gates.share_any('tokens'). The function still makes the complete decision; pairs outside the gate must be impossible positives. Non-transitive similarity components are candidate partitions, not final semantic clusters.