Managing Examples
By associating relevant examples with specific labels, you help the system better understand the context and improve its accuracy in assigning labels.
What Are Examples?
Examples are sample data points tied to specific labels. They provide the classification model with reference points to make more informed predictions. Each example is linked to a single label and contains relevant text.
Example Object Structure
| Field | Type | Required | Description |
|---|---|---|---|
cuid | String | Yes | Unique identifier for the example, auto-generated (e.g., z12abc3d4ef5). |
labelCuid | String | Yes | The unique identifier of the label this example is associated with. |
example | String | Yes | The content of the example, such as an email body or message. |
Example Object:
{
"cuid": "z12abc3d4ef5",
"labelCuid": "f45sz0ho8rcl",
"example": "I would like to complain about a recent purchase."
}
Endpoints for Managing Examples
1. Create an Example
Endpoint:
POST /api/companies/{companyCuid}/orchestrators/{orchestratorCuid}/classification/labels/{labelCuid}/examples
Payload Structure:
| Field | Type | Required | Description |
|---|---|---|---|
example | String | Yes | The text content of the example. |
Payload Example:
{
"example": "I would like to complain about a recent purchase."
}
Response Example:
{
"cuid": "z12abc3d4ef5",
"labelCuid": "f45sz0ho8rcl",
"example": "I would like to complain about a recent purchase."
}
2. Retrieve All Examples for a Label
Endpoint:
GET /api/companies/{companyCuid}/orchestrators/{orchestratorCuid}/classification/labels/{labelCuid}/examples
Response Example:
{
"examples": [
{
"cuid": "z12abc3d4ef5",
"example": "I would like to complain about a recent purchase."
},
{
"cuid": "d67efg8h9ijk",
"example": "This product does not meet my expectations."
}
]
}
3. Retrieve a Single Example
Endpoint:
GET /api/companies/{companyCuid}/orchestrators/{orchestratorCuid}/classification/labels/{labelCuid}/examples/{exampleCuid}
Response Example:
{
"cuid": "z12abc3d4ef5",
"text": "I would like to complain about a recent purchase."
}
4. Update an Example
Endpoint:
PATCH /api/companies/{companyCuid}/orchestrators/{orchestratorCuid}/classification/labels/{labelCuid}/examples/{exampleCuid}
Payload Structure:
| Field | Type | Required | Description |
|---|---|---|---|
example | String | Yes | The updated text content of the example. |
Payload Example:
{
"example": "I want to file a complaint about the service I received."
}
Response Example:
{
"cuid": "z12abc3d4ef5",
"example": "I want to file a complaint about the service I received."
}
5. Delete an Example
Endpoint:
DELETE /api/companies/{companyCuid}/orchestrators/{orchestratorCuid}/classification/labels/{labelCuid}/examples/{exampleCuid}
Response:
- On success, the server returns a
200 OKstatus with no additional content.
Best Practices for Examples
- Use Representative Text: Ensure examples accurately reflect the kinds of text you expect to classify.
- Diversify Your Examples: Provide a variety of examples to cover different contexts and edge cases.