Samples
Samples consist of phrases or sentences that are used to train an NLU model. Samples are labeled with intents and annotated with entities.
About exported samples
The package file exported with the export samples endpoint uses the following naming convention:
projectid-intentname-samples-exportdate-exporttime.zip
Where:
- projectid is the ID of the project
- projectname is the name of the project
- intentname is the name of the intent for which samples were exported
- exportdate is the date that the package was exported, in the
yyyy-mm-dd
format - exporttime is the time that the package was exported, in the
hh-mm-ss
format, using Greenwich Mean Time (GMT)
For example:
- Samples export: 2960-Coffee App-ORDER_COFFEE-samples-2021-06-01-19-55-35.zip
Samples package file content
A samples package includes one or more TRSX samples file, one for each locale in the project:
File name | Description |
---|---|
locale.trsx (for example, en_US.trsx ) |
TRSX file that defines the samples for the locale. See the TRSX documentation for details. |
Replacing and appending samples
When you replace samples, the samples included in the samples file provided replace the existing samples in the project.
When you append samples, the samples are added to the existing ones.
The samples file provided must be either:
- A valid TRSX file; see the TRSX documentation for details
- A .txt file; see Importing NLU samples
Export project intent samples
GET /v4/projects/{projectId}/intents/{intentName}/samples/.export
Export the samples for an intent in a project.
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | Intent samples package (zip file, with application/octet-stream content-type) | Inline |
401 | Unauthorized | Request could not be authorized | Inline |
404 | Not Found | Project not found | Inline |
500 | Internal Server Error | Internal server error | Inline |
default | Default | An unexpected error response. | grpc.gateway.runtime.Error |
Append project samples
PUT /v4/projects/{projectId}/intents/{intentName}/samples/.append
Append the samples in the provided file to the existing samples for the specified project and intent. The samples must be provided in a valid TRSX file (.trsx) or in a text file (.txt).
Parameters
Name | In | Type | Description |
---|---|---|---|
projectId | path | string | ID of project to append the samples to. |
intentName | path | string | Case-sensitive name of intent for which to append the samples. |
locale | query | string | Locale for which the samples will be appended. |
» content | body | string (binary) | Samples content file. Can be .trsx or .txt. |
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | Job successfully created | mix.api.JobResponse |
401 | Unauthorized | Request could not be authorized | Inline |
404 | Not Found | Project not found | Inline |
500 | Internal Server Error | Internal server error | Inline |
default | Default | An unexpected error response. | grpc.gateway.runtime.Error |
Example responses
Replace project intent samples
POST /v4/projects/{projectId}/intents/{intentName}/samples/.replace
Replace the existing project samples associated with an intent with the ones provided in the file. The samples must be provided in a valid TRSX file (.trsx) or in a text file (.txt).
Warning:
This endpoint will delete any existing project samples.Parameters
Name | In | Type | Description |
---|---|---|---|
projectId | path | string | ID of project for which to replace intent samples. |
intentName | path | string | Case-sensitive name of intent for which to replace samples. |
locale | query | string | Locale for which to replace samples. |
» content | body | string (binary) | Samples content file. Can be .trsx or .txt. |
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | Job successfully created | mix.api.JobResponse |
401 | Unauthorized | Request could not be authorized | Inline |
404 | Not Found | Project not found | Inline |
500 | Internal Server Error | Internal server error | Inline |
default | Default | An unexpected error response. | grpc.gateway.runtime.Error |
Example responses
Feedback
Was this page helpful?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.