ai.classify
Operation: ai.classify
Category: ai
Tags: text, classification
Classify text into one of a set of labels using an AI provider
Runtime
Section titled “Runtime”Type: AI Provider (routed via provider registry)
Timeout: 300s
Retries: 3 (ExponentialWithJitter)
Inputs
Section titled “Inputs”| Name | Type | Required | Default | Description |
|---|---|---|---|---|
text | String | Yes | — | Text to classify |
Outputs
Section titled “Outputs”| Name | Type | Description |
|---|---|---|
label | String | Selected label |
confidence | String | Confidence level (high/low) |
labels | Array<String> | All available labels |
raw_response | String | Raw provider response |
Default Configuration
Section titled “Default Configuration”{ "labels": [ "positive", "negative", "neutral" ]}import { WorkflowBuilder } from "@fabric-platform/sdk";
const workflow = new WorkflowBuilder("my-workflow") .node("ai-classify", "ai_invoke", (n) => n.config({ operation: "ai.classify", // ... node-specific config }) ) .build();from fabric_platform import FabricClient
fabric = FabricClient(api_key="fab_xxx")
wf_id = fabric.upsert_workflow("my-workflow", nodes=[ { "key": "ai-classify", "kind": "ai_invoke", },])use fabric_sdk::FabricClient;
let client = FabricClient::new("http://localhost:3001", api_key)?;
let wf_id = client.upsert_workflow("my-workflow", serde_json::json!({ "nodes": [{ "key": "ai-classify", "kind": "ai_invoke" }]})).await?;curl -X POST http://localhost:3001/v1/workflow-definitions \ -H "Authorization: Bearer $FABRIC_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "name": "my-workflow", "nodes": [{ "key": "ai-classify", "kind": "ai_invoke" }] }'Example
Section titled “Example”{ "key": "classify-sentiment", "operation": "ai.classify", "config": { "labels": ["positive", "negative", "neutral"] }, "inputs": [{ "name": "text", "path": "$context.review_text" }], "outputs": [{ "name": "label", "path": "$context.sentiment" }]}Common Errors
Section titled “Common Errors”Classification returned unknown label
Section titled “Classification returned unknown label”Cause: The AI response did not match any of the configured labels
Fix: The raw response is returned as the label with confidence ‘low’. Add more descriptive labels or use a prompt_template for better accuracy