> ## Documentation Index
> Fetch the complete documentation index at: https://docs.eigenpal.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Classify

> Classify a document or text into one of a fixed label set using an LLM. Output exposes the picked label (constrained to the configured names), a coarse confidence, and a short justification. Pair with control.fail to reject documents that match an undesired label.

`ai.classify`, Classify a document or text into one of a fixed label set using an LLM. Output exposes the picked label (constrained to the configured names), a coarse confidence, and a short justification. Pair with control.fail to reject documents that match an undesired label.

## Configuration

Configuration goes inside the step's `with:` block.

<ParamField path="input" type="string" required>
  Template expression for the text to classify. Typically the output of ai.parse, e.g. "\{\{ steps.parse.output.text }}".
</ParamField>

<ParamField path="labels" type="array<object>" required>
  Allowed labels. The LLM is constrained to pick exactly one of these names.

  <Expandable title="labels properties">
    <ParamField path="name" type="string" required>
      The label value returned in output.label. Keep it short and stable (used in downstream conditions).
    </ParamField>

    <ParamField path="description" type="string">
      What documents fall into this label. Fed to the LLM as guidance.
    </ParamField>
  </Expandable>
</ParamField>

<ParamField path="prompt" type="string">
  Custom classification instructions appended to the system prompt. Use to clarify edge cases or emphasize evidence the model should weigh.
</ParamField>

<ParamField path="provider" type="string">
  Provider ID from eigenpal.config.yaml (e.g. "openai-gpt4o-mini"). Falls back to the tenant default LLM provider when omitted.
</ParamField>

<ParamField path="model" type="string">
  Model override (advanced)
</ParamField>

<ParamField path="maxInputTokens" type="integer">
  Max input tokens. Truncates input text when exceeded. Omit for no limit.
</ParamField>

## Output

<ResponseField path="label" type="string" required>
  The selected label name (one of the configured labels). Compare against literal strings to gate downstream steps.
</ResponseField>

<ResponseField path="confidence" type="&#x22;low&#x22; | &#x22;medium&#x22; | &#x22;high&#x22;" required>
  LLM confidence in the classification. Coarse enum, numeric scores cluster meaninglessly at 0.85-0.95.
</ResponseField>

<ResponseField path="reason" type="string" required>
  Short justification for the chosen label, useful for debugging.
</ResponseField>
