Skip to main content
POST
/
api
/
v1
/
llm
/
classify
Typescript (SDK)
import { SDK } from "@meetkai/mka1";

const sdk = new SDK({
  bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const result = await sdk.llm.classify.classify({
    classificationRequest: {
      model: "meetkai:functionary-urdu-mini-pak",
      text: "I absolutely love this product! Best purchase ever.",
      labels: [
        "positive",
        "negative",
        "neutral",
      ],
    },
  });

  console.log(result);
}

run();
{
  "success": true,
  "data": {
    "label": "positive",
    "confidence": 0.92,
    "reasoning": "The text expresses strong enthusiasm with phrases like 'absolutely love' and 'best purchase ever'."
  },
  "metadata": {
    "model": "meetkai:functionary-urdu-mini-pak",
    "labels": [
      "positive",
      "negative",
      "neutral"
    ],
    "classifiedAt": "2024-01-15T10:30:00Z"
  }
}

Authorizations

Authorization
string
header
required

Authenticate with your MKA1 API key at the API gateway: Authorization: Bearer <mka1-api-key>. For multi-user server-side integrations, also send X-On-Behalf-Of to identify the end user making the request.

Headers

X-On-Behalf-Of
string

Optional external user identifier for multi-user server-side integrations. Use this when acting on behalf of one of your end users.

Body

application/json

Request parameters for text classification. The model will analyze the text and assign it to one of the provided labels.

model
string
required

ID of the model to use for classification. You can use provider:model format or just the model name with a default provider.

Minimum string length: 1
text
string
required

The text content to classify. Must not be empty.

Minimum string length: 1
labels
string[]
required

Array of possible classification labels. Must contain at least 2 labels. The model will choose one of these labels to assign to the text.

Minimum array length: 2
Minimum string length: 1
prompt
string

Optional custom system prompt to guide the classification. Use this to provide additional context or instructions to the model about how to perform the classification.

Response

200 - application/json

OK

Response from the text classification endpoint containing the classification result, confidence, and metadata.

success
boolean
required

Indicates whether the classification request was successful

data
object
required

The classification result data

metadata
object
required

Metadata about the classification request and execution