AI Classify
Classifies input into one of your configured classes.
@lainstack/ai/classify · AI
How to use it
Section titled “How to use it”Puts one input into exactly one of 2 to 8 classes that you define. Use it to route work by intent, document type or category. For free-form answers use @lainstack/ai/prompt. For multi-step investigation use @lainstack/ai/agent.
- The block has one “out” port. To branch, add
@lainstack/flow/switchafter it and compareclassIdwith your class ids. - Each class needs a unique
id(lowercase, starts with a letter, letters, digits, “_” and “-”, up to 64 characters), alabelandcriteria(up to 2,000 characters) that say when the class applies. Clear, non-overlapping criteria matter more thaninstructions. - The model must pick one class. It cannot answer “none”. Add an explicit catch-all class such as “other” if the input may fit nothing.
inputKindmust match the value ininput. A mismatch fails the block (ai_classification_input_invalid) and is not retried.- A provider reply that is not one of your classes fails the block (
ai_classification_invalid_response). There is no fallback to another model. probabilitiesandconfidenceappear only when the provider returns them. They are never estimated.engineKindsays whether a native decision model or a structured language model answered.- Needs an AI connection (provider or decision provider) and a model of that connection. The timeout defaults to 30 s (allowed 1 s to 300 s).
- A replay or a test run calls the model again, unless the block has a pinned sample output (
testing).
Settings
Section titled “Settings”| Setting | Key | Type | Details |
|---|---|---|---|
| Connection (required) | credentialId |
Connection | |
| Model (required) | model |
Text | At most 240 characters. |
| Input (required) | input |
Text | |
| Instructions | instructions |
Text | |
| Classes (required) | classes |
List | From 2 to 8 items. |
| Timeout | timeoutMs |
Number |
Outputs
Section titled “Outputs”| Output | Path | Type |
|---|---|---|
| Class ID | classId |
Text |
| Class label | classLabel |
Text |
| Engine | engineKind |
Text |
| Configured model | configuredModel |
Text |
| Resolved model | resolvedModel |
Text |
| Probabilities | probabilities |
List |
| Provider confidence | confidence.value |
Number |