Skip to main content
After running a rubric evaluation, Docent can cluster judge results to identify common patterns. See Search and Clustering for a walkthrough.

Get Clustering State

from docent import Docent

client = Docent()

state = client.get_clustering_state("my-collection-id", "rubric-123")
print(f"Job ID: {state.get('job_id')}")
print(f"Centroids: {len(state.get('centroids', []))}")

Parameters

collection_id
str
required
ID of the collection.
rubric_id
str
required
ID of the rubric.

Returns

state
dict
Clustering state.

Get Cluster Centroids

centroids = client.get_cluster_centroids("my-collection-id", "rubric-123")
for centroid in centroids:
    print(centroid)

Parameters

collection_id
str
required
ID of the collection.
rubric_id
str
required
ID of the rubric.

Returns

centroids
list[dict]
List of centroid information dictionaries.

Get Cluster Assignments

assignments = client.get_cluster_assignments("my-collection-id", "rubric-123")
for centroid_id, result_ids in assignments.items():
    print(f"Cluster {centroid_id}: {len(result_ids)} results")

Parameters

collection_id
str
required
ID of the collection.
rubric_id
str
required
ID of the rubric.

Returns

assignments
dict[str, list[str]]
Mapping of centroid IDs to lists of judge result IDs belonging to that cluster.