Quick Start: Classification with Agent Assist
This guide will help you get started quickly with the classification feature of the Agent Assist API. You'll create labels, add examples, and classify a piece of text in just a few steps.
Step 1: Create Your First Labels
Labels define the categories you want to use for classification. Let’s create a label called "Reclamation".
Endpoint: POST /api/companies/{companyCuid}/orchestrators/{orchestratorCuid}/classification/labels
Payload Example:
{
"name": "reclamation",
"description": "Issues related to complaints or claims."
}
Example cURL Request:
curl -X POST https://api.dialonce.ai/agent-assist/v1/companies/{companyCuid}/orchestrators/{orchestratorCuid}/classification/labels \
-H "Authorization: Bearer YOUR_BEARER_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "reclamation",
"description": "Issues related to complaints or claims."
}'
Example Response:
{
"cuid": "f45sz0ho8rcl",
"name": "reclamation",
"description": "Issues related to complaints or claims."
}
Step 2: Add an Example to Your Label
Examples help the API better understand what kind of text belongs to a label. Let’s add an example to the "Reclamation" label.
Endpoint: POST /api/companies/{companyCuid}/orchestrators/{orchestratorCuid}/classification/labels/{labelCuid}/examples
Payload:
{
"example": "I need to file a complaint about a damaged product."
}
Example cURL Request:
curl -X POST https://api.dialonce.ai/agent-assist/v1/companies/{companyCuid}/orchestrators/{orchestratorCuid}/classification/labels/{labelCuid}/examples \
-H "Authorization: Bearer YOUR_BEARER_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"example": "I need to file a complaint about a damaged product."
}'
Example Response:
{
"cuid": "g5st08hu8r6l",
"example": "I need to file a complaint about a damaged product."
}
Step 3: Classify Text
With your label and example set up, you can now classify some text using for example the synchronous classification endpoint.
Endpoint: POST /api/companies/{companyCuid}/orchestrators/{orchestratorCuid}/classification
Payload:
{
"subject": "Complaint about a product",
"body": "I received a damaged item and would like a refund.",
"metadata": {
"date": "2024-09-11",
"policy_number": "123456789",
"sender": "jean.dupont@mail.com"
}
}
Example cURL Request:
curl -X POST https://api.dialonce.ai/agent-assist/v1/companies/{companyCuid}/orchestrators/{orchestratorCuid}/classification \
-H "Authorization: Bearer YOUR_BEARER_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"subject": "Complaint about a product",
"body": "I received a damaged item and would like a refund.",
"metadata": {
"date": "2024-09-11",
"policy_number": "123456789",
"sender": "jean.dupont@mail.com"
}
}'
Example Response:
{
"main_prediction": "reclamation",
"predictions": [
{
"label": "reclamation",
"confidence": "high",
"priority": 1
}
]
}
What’s Next?
- Learn how to Manage Labels to organize and customize the classification categories.
- Discover how to Add Examples to improve the classification accuracy for your labels.
- Explore the details of the Synchrosous Classification Endpoint or Asynchrosous Classification Endpoint to understand how to send requests and handle responses.