A collection is a container for agent runs, rubrics, and evaluation results.
See Introduction for more on how collections fit into the Docent workflow.
Create a Collection
from docent import Docent
client = Docent()
collection_id = client.create_collection(
name = "GPT-4 Customer Support Runs" ,
description = "Production runs from the support agent" ,
metadata = { "team" : "support" , "model" : "gpt-4" },
)
print (collection_id) # e.g., "a1b2c3d4-..."
Parameters
Optional ID for the new collection. If not provided, one is generated automatically.
Display name for the collection.
Description of the collection’s purpose.
Arbitrary key-value metadata to attach to the collection.
Returns
The ID of the created collection.
List Collections
collections = client.list_collections()
for c in collections:
print ( f " { c[ 'id' ] } : { c[ 'name' ] } ( { c[ 'counts' ][ 'agent_run_count' ] } runs)" )
Returns
List of collection summary objects, including ownership, your permission level, and precomputed counts. Show Collection object fields
ISO timestamp of creation.
Owner of the collection. Whether the owner is an anonymous user.
True if the requesting user owns the collection.
Requesting user’s permission level on the collection: "read", "write", or "admin".
Precomputed counts for the collection. Number of agent runs in the collection.
Get a Collection
import requests
try :
collection = client.get_collection( "my-collection-id" )
print (collection[ "name" ])
except requests.exceptions.HTTPError as e:
if e.response.status_code == 404 :
print ( "Collection not found" )
else :
raise
Parameters
ID of the collection to retrieve.
Returns
Collection details with ownership, your permission level, and precomputed counts. Show Collection object fields
ISO timestamp of creation.
Owner of the collection. Whether the owner is an anonymous user.
True if the requesting user owns the collection.
Requesting user’s permission level on the collection: "read", "write", or "admin".
Precomputed counts for the collection. Number of agent runs in the collection.
Errors
HTTPError (404) — Collection not found
Update a Collection
client.update_collection(
"my-collection-id" ,
name = "Renamed Collection" ,
description = "Updated description" ,
)
Parameters
ID of the collection to update.
New name. If None, the name is left unchanged.
New description. If None, the description is left unchanged.
Delete Agent Runs
Remove specific agent runs from a collection.
deleted = client.delete_agent_runs( "my-collection-id" , [ "run-1" , "run-2" ])
print ( f "Deleted { deleted } runs" )
Parameters
List of agent run IDs to delete.
Returns
Number of agent runs deleted.
Errors
ValueError — agent_run_ids is empty
HTTPError (404) — Collection not found