Managing Labels
Labels are essential for organizing and categorizing text with the Agent Assist classification API. This guide explains how to create, retrieve, update, and delete labels.
What Are Labels?
Labels represent the categories used for classifying text. A label is represented as a JSON object with the following structure:
Label Object Structure
| Field | Type | Description |
|---|---|---|
cuid | String | Unique identifier for the label, auto-generated. |
name | String | The label's name, must be unique within the orchestrator. |
description | String | A detailed explanation of the label's purpose. |
Example:
{
"cuid": "f45sz0ho8rcl",
"name": "reclamation",
"description": "Issues related to complaints or claims."
}
Endpoints for Managing Labels
1. Create a Label
Endpoint:
POST /api/companies/{companyCuid}/orchestrators/{orchestratorCuid}/classification/labels
Payload Structure:
| Field | Type | Required | Description |
|---|---|---|---|
name | String | Yes | The label's name, must be unique. |
description | String | Yes | A detailed explanation of the label's purpose. |
Payload Example:
{
"name": "reclamation",
"description": "Issues related to complaints or claims."
}
Response Example:
{
"cuid": "f45sz0ho8rcl",
"name": "reclamation",
"description": "Issues related to complaints or claims."
}
2. Retrieve All Labels
Endpoint:
GET /api/companies/{companyCuid}/orchestrators/{orchestratorCuid}/classification/labels
Response Example:
[
{
"cuid": "f45sz0ho8rcl",
"name": "reclamation",
"description": "Issues related to complaints or claims."
},
{
"cuid": "j82nd1kx9vqo",
"name": "billing",
"description": "Questions about invoices or payments."
}
]
3. Retrieve a Single Label
Endpoint:
GET /api/companies/{companyCuid}/orchestrators/{orchestratorCuid}/classification/labels/{labelCuid}
Response Example:
{
"cuid": "f45sz0ho8rcl",
"name": "reclamation",
"description": "Issues related to complaints or claims."
}
4. Update a Label
Endpoint:
PATCH /api/companies/{companyCuid}/orchestrators/{orchestratorCuid}/classification/labels/{labelCuid}
Payload Structure:
| Field | Type | Required | Description |
|---|---|---|---|
name | String | No | The updated name for the label. |
description | String | No | The updated description for the label. |
Payload Example:
{
"name": "reclamation_updated",
"description": "Updated description for the label."
}
Response Example:
{
"cuid": "f45sz0ho8rcl",
"name": "reclamation_updated",
"description": "Updated description for the label."
}
5. Delete a Label
Endpoint:
DELETE /api/companies/{companyCuid}/orchestrators/{orchestratorCuid}/classification/labels/{labelCuid}
Response:
- On success, the server returns a 200 OK status with no additional content.
6. Improving Classification with Examples
To improve the accuracy of your classifications, you can associate examples to your labels. Examples help the system better understand the context and nuances of your labels.
Learn more about managing examples on the Managing Examples page.
Best Practices for Labels
- Ensure Names Are Unique: Avoid confusion by using distinct label names.
- Provide Clear Descriptions: Help collaborators and the system understand the label's purpose.