Function Types

Classify Functions

Route inputs down labeled paths based on content classification

Hand off to an LLM

Classify functions analyze incoming data and direct it down one of several labeled paths, enabling branching workflows driven by content rather than metadata. The model decides which classification an input belongs to based on the per-classification descriptions you provide.

When to Use

Use a Classify function when you need to:

  • Identify document types (invoices, receipts, contracts, etc.) and send each to a specialized Extract function
  • Build branching workflows where different content needs different processing
  • Handle mixed document batches from a shared inbox or upload channel
  • Apply a fallback path for inputs that don't match any known category

Configuration Fields

Required Fields

FieldTypeDescription
functionNamestringUnique identifier for the function
typestringMust be "classify"
descriptionstringDescription of the classification logic and expected inputs
classificationsarrayArray of classification definitions

Optional Fields

FieldTypeDefaultDescription
displayNamestring-Human-readable display name
tagsstring[]-Tags for organization

Classification Configuration

Each entry in the classifications array has these fields:

FieldTypeRequiredDescription
namestringYesUnique name for this classification — referenced by destinationName in workflow edges
descriptionstringNoDescription of when this classification applies
functionNamestringConditionalTarget function name
isErrorFallbackbooleanNoIf true, handles inputs that don't match other classifications

Example

{
  "functionName": "document-classifier",
  "type": "classify",
  "displayName": "Document Classifier",
  "description": "Classifies incoming documents and routes them to the appropriate extraction function. Handles invoices, receipts, purchase orders, and contracts.",
  "classifications": [
    {
      "name": "invoices",
      "description": "Invoice documents including bills and payment requests",
      "functionName": "invoice-extractor"
    },
    {
      "name": "receipts",
      "description": "Receipts from purchases and transactions",
      "functionName": "receipt-extractor"
    },
    {
      "name": "purchase-orders",
      "description": "Purchase order documents",
      "functionName": "po-extractor"
    },
    {
      "name": "contracts",
      "description": "Legal contracts and agreements",
      "functionName": "contract-extractor"
    },
    {
      "name": "unknown",
      "description": "Fallback for documents that don't match other categories",
      "functionName": "generic-extractor",
      "isErrorFallback": true
    }
  ],
  "tags": ["classification", "workflow"]
}

Writing Effective Descriptions

The description field on each classification is what the model uses to decide where an input belongs. Include:

  1. Clear criteria — What makes an input belong to this classification?
  2. Examples — Specific document types or characteristics
  3. Distinguishing features — How to differentiate from similar classifications

Good Description Example

{
  "name": "invoices",
  "description": "Invoice documents. These typically include: vendor information, invoice number, line items with quantities and prices, payment terms, and a total amount due. Includes bills, payment requests, and statements with amounts owed."
}

Weak Description Example

{
  "name": "invoices",
  "description": "For invoices"
}

Error Fallback

Always include a fallback classification with isErrorFallback: true to handle inputs that don't match any other category. This prevents unclassified inputs from failing the workflow.

Wiring Into a Workflow

In a workflow, edges leaving a Classify function use destinationName to match the classifications[].name on this function. See Workflows Explained for the full branching pattern.

Email Integration

Classify functions automatically receive an email address. Forward emails to this address to classify them and fan out to the appropriate downstream function.

The email address is returned in the function response as emailAddress (e.g., eml_xxx@actions.bem.ai).

On this page