Skip to main content
POST
/
classify
Text classification
curl --request POST \
  --url http://localhost:8000/classify \
  --header 'Content-Type: application/json' \
  --data '
{
  "input": "I love programming."
}
'
{
  "data": [
    {
      "index": 0,
      "label": "Positive",
      "num_classes": 2,
      "probs": [
        0.9,
        0.1
      ]
    }
  ],
  "object": "list",
  "usage": {
    "prompt_tokens": 5,
    "total_tokens": 5
  }
}
Given a text input, the model classifies it into categories.

Body

application/json
model
string | null

Routes the request to a specific adapter.

Example:

"(adapter-route)"

input

Input text to classify, encoded as a string or array of strings. To classify multiple inputs in a single request, pass an array of strings.

Either input or tokens field is required.

Example:

"I love programming."

tokens
integer[] | null

The tokenized prompt (i.e., input tokens).

Either input or tokens field is required.

Example:

72

Response

Successfully classified the text input.

data
BaseClassificationData · object[]
required
object
string
required

The object type, which is always set to list.

Allowed value: "list"
usage
TextClassificationUsage · object
required