v1

latestOpenAPI 3.0.32026-07-26451985.7 KB

zero-shot-classification

Classify text into categories not seen during training for applications like intent detection, content moderation, and dynamic classification

post/models/v2/facebook/bart-large-mnli

Request body

textstring required
candidate_labelsstring[] required

Example request

{
  "text": "One day I will see the world",
  "candidate_labels": [
    "travel",
    "cooking",
    "dancing"
  ]
}

Response

Successful zero-shot-classification response.

errorstring nullable required

Null on success; otherwise an error message.

outputobject required

Successful response with text-classification sequence, labels, and scores

Example response

{
  "output": {
    "sequence": "One day I will see the world",
    "labels": [
      "travel",
      "dancing",
      "cooking"
    ],
    "scores": [
      0.9941015839576721,
      0.0031261409167200327,
      0.002772255800664425
    ]
  }
}