curl --request POST \
--url https://api.friendli.ai/dedicated/classify \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "(endpoint-id)"
}
'{
"data": [
{
"index": 0,
"label": "Positive",
"num_classes": 2,
"probs": [
0.9,
0.1
]
}
],
"object": "list",
"usage": {
"prompt_tokens": 5,
"total_tokens": 5
}
}Dedicated text classification
Classify text into categories using your Friendli Dedicated Endpoint. Send text input and receive predicted labels with per-class probabilities.
curl --request POST \
--url https://api.friendli.ai/dedicated/classify \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "(endpoint-id)"
}
'{
"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. To request successfully, it is mandatory to enter a Personal API Key (e.g. flp_XXX) value in the Bearer Token field. Refer to the authentication section on our introduction page to learn how to acquire this variable and visit here to generate your API Key.Documentation Index
Fetch the complete documentation index at: https://friendli.ai/docs/llms.txt
Use this file to discover all available pages before exploring further.
Authorizations
Headers
ID of team to run requests as (optional parameter).
Body
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.
"(endpoint-id)"
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.
"I love programming."
The tokenized prompt (i.e., input tokens).
Either input or tokens field is required.
72
Response
Successfully classified the text input.
Hide child attributes
Hide child attributes
The index of the input in the list of inputs.
0
The predicted label for the input text.
"Positive"
The number of possible labels the model can predict.
2
A list of logits for each possible label.
[0.1, 0.9]The object type, which is always set to list.
"list"