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"
}
}Classifies text content into one of the provided predefined labels.
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"
}
}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.
Optional external user identifier for multi-user server-side integrations. Use this when acting on behalf of one of your end users.
Request parameters for text classification. The model will analyze the text and assign it to one of the provided labels.
ID of the model to use for classification. You can use provider:model format or just the model name with a default provider.
1The text content to classify. Must not be empty.
1Array of possible classification labels. Must contain at least 2 labels. The model will choose one of these labels to assign to the text.
21Optional custom system prompt to guide the classification. Use this to provide additional context or instructions to the model about how to perform the classification.
OK
Response from the text classification endpoint containing the classification result, confidence, and metadata.
Was this page helpful?