/v1/labelClassify text content based on your custom criteria.
https://api.zentropi.ai
Authorization: Bearer your_api_key_here
| Field | Type | Required | Description |
|---|---|---|---|
content_text |
string | Yes | The text content to be labeled |
criteria_text |
string | No | The labeling criteria to use. Either criteria_text OR labeler_id is required. |
labeler_id |
string | No | The ID of the labeler to use. Either criteria_text OR labeler_id is required. |
labeler_version_id |
string | No | The ID of which deployed version to use. Required if labeler_id is set. Default: "latest" |
model |
string | No | Model to use for evaluation. Default: "cope-latest" |
| Field | Type | Description |
|---|---|---|
label |
string | The classification result ("0" or "1") |
confidence |
float | Confidence score for the classification (0.5 to 1.0) |
compute_time |
float | Time taken to process the request in seconds |
{
"label": "1",
"confidence": 0.87,
"compute_time": 0.324
}
import requests
ZAPI_KEY = "your_api_key_here"
ZAPI_URL = "https://api.zentropi.ai/v1/label"
# Label content using Zentropi
content_text = "This is some text to analyze"
criteria_text = "This is your labeling criteria"
response = requests.post(
ZAPI_URL,
headers={"Authorization": f"Bearer {ZAPI_KEY}"},
json={
"content_text": content_text,
"criteria_text": criteria_text,
}
)
result = response.json()
print(f"Label: {result['label']}")
print(f"Confidence: {result['confidence']}")
# Example output:
# Label: 1
# Confidence: 0.85
const ZAPI_KEY = "your_api_key_here";
const ZAPI_URL = "https://api.zentropi.ai/v1/label";
// Label content using Z-API
const labelContent = async () => {
const response = await fetch(ZAPI_URL, {
method: "POST",
headers: {
"Authorization": `Bearer ${ZAPI_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
content_text: "This is some text to analyze",
criteria_text: "This is your labeling criteria"
})
});
const result = await response.json();
console.log(`Label: ${result.label}`);
console.log(`Confidence: ${result.confidence}`);
};
labelContent();
// Example output:
// Label: 1
// Confidence: 0.85