Dedicated.Classification

Text classification

Given a text input, the model classifies it into categories.

post/dedicated/classify

Request

Headers

X-Friendli-Teamstring nullable

ID of team to run requests as (optional parameter).

Request body

modelstring required

ID of target endpoint. If you want to send request to specific adapter, use the format "YOUR_ENDPOINT_ID:YOUR_ADAPTER_ROUTE". Otherwise, you can just use "YOUR_ENDPOINT_ID" alone.

tokensinteger[] nullable

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

Either input or tokens field is required.

Example request

{
  "input": "I love programming.",
  "model": "(endpoint-id)"
}

Response

Successfully classified the text input.

object'list' required

The object type, which is always set to list.

Example response

{
  "data": [
    {
      "label": "Positive",
      "num_classes": 2,
      "probs": [
        0.1,
        0.9
      ]
    }
  ],
  "usage": {
    "prompt_tokens": 10,
    "total_tokens": 10
  }
}

Changes

No recorded changes to this operation across all 1 revision of this API.