Foundation Models Text Classification API, gRPC: TextClassificationService.FewShotClassify
RPC method for binary and multi-class classification.
You can provide up to 20 classes for few-shot text classification
with optional examples.
gRPC request
rpc FewShotClassify (FewShotTextClassificationRequest) returns (FewShotTextClassificationResponse)
FewShotTextClassificationRequest
{
"modelUri": "string",
"taskDescription": "string",
"labels": [
"string"
],
"text": "string",
"samples": [
{
"text": "string",
"label": "string"
}
]
}
Request for the service to classify text.
For examples of usage, see step-by-step guides.
Field |
Description |
modelUri |
string The URI of the classifier model. |
taskDescription |
string Text description of the classification task. |
labels[] |
string List of available labels for the classification result. |
text |
string Text for classification. |
samples[] |
Optional set of text samples with expected labels that may be used as an additional hint for the classifier. |
ClassificationSample
Description of a sample for the classification task.
Field |
Description |
text |
string Text sample. |
label |
string Expected label for a given text. |
FewShotTextClassificationResponse
{
"predictions": [
{
"label": "string",
"confidence": "double"
}
],
"modelVersion": "string"
}
Response containing classifier predictions.
Field |
Description |
predictions[] |
The classification results with the `confidence`` values |
modelVersion |
string The model version changes with each new releases. |
ClassificationLabel
A pair of text labels and their corresponding confidence values.
Field |
Description |
label |
string A class name label. |
confidence |
double The probability of classifying text into a specific class. |