Foundation Models Text Classification API, gRPC: TextClassificationService
Статья создана
Обновлена 15 мая 2024 г.
Service for classifying text from input text.
Call | Description |
---|---|
Classify | RPC method for text classification. |
FewShotClassify | RPC method for few-shot text classification. |
Calls TextClassificationService
Classify
RPC method for text classification.
rpc Classify (TextClassificationRequest) returns (TextClassificationResponse)
TextClassificationRequest
Field | Description |
---|---|
model_uri | string The identifier of the classification model. |
text | string Text for classification. |
TextClassificationResponse
Field | Description |
---|---|
predictions[] | ClassificationLabel Result of classification - a list of label-confidence pairs. |
model_version | string Model version (changes with model releases). |
ClassificationLabel
Field | Description |
---|---|
label | string A label with a class name. |
confidence | double Confidence of item's belonging to a class. |
FewShotClassify
RPC method for few-shot text classification.
rpc FewShotClassify (FewShotTextClassificationRequest) returns (FewShotTextClassificationResponse)
FewShotTextClassificationRequest
Field | Description |
---|---|
model_uri | string The identifier of the classification model. |
task_description | string Text description of the classification task. |
labels[] | string List of available labels for the classification result. |
text | string Text for classification. |
samples[] | ClassificationSample Optional set of text samples with expected labels that may be used as an additional hint for the classifier. |
ClassificationSample
Field | Description |
---|---|
text | string Text sample. |
label | string Expected label for a given text. |
FewShotTextClassificationResponse
Field | Description |
---|---|
predictions[] | ClassificationLabel Result of classification - a list of label-confidence pairs. |
model_version | string Model version (changes with model releases). |
ClassificationLabel
Field | Description |
---|---|
label | string A label with a class name. |
confidence | double Confidence of item's belonging to a class. |