Examples / Classification

Classification

Real-world classification patterns: route messy text into a small, explicit set of labels. These examples are designed to run in mock mode (fast, deterministic) and also in real mode (with API keys and/or optional ML dependencies) so you can iterate safely.

Examples in This Chapter

Support Inbox Triage

Has SpecsRequires API Keys

Route a support message into one of four queues. Demonstrates: - LLM classification with an explicit label set - Built-in retry loop when the model returns an invalid label - Returning both the label and retry_count for observability

View example →

Composite Fuzzy Then Llm

Has SpecsRequires API Keys

Compose classifiers: use fuzzy matching for obvious cases first, then fall back to an LLM for the long tail. Demonstrates: - Fuzzy matching (fast, offline) for known phrases/keywords - LLM classification fallback - Returning which path was used (fuzzy vs llm)

View example →

Model Primitive Sentiment

Has Specs

A minimal Model primitive example using a mock backend. Demonstrates: - Stateless prediction via the Model primitive - Input/output schemas on the model itself - Deterministic specs that run in CI without API keys

View example →

Model Train Imdb Naive Bayes

Has Specs

Train a real (local) sentiment classifier using Naive Bayes + TF-IDF on the IMDB dataset, register it, then call it from a Procedure. Demonstrates: - A single Model block that includes both runtime config and training config - A real training + evaluation loop via the CLI (`tactus train`, `tactus models evaluate`) - CI-safe specs that test your branching logic via `Mocks { ... }`

View example →

Model Train Imdb Hf Sequence Classifier

Has Specs

Train a Hugging Face sequence classifier (AutoModelForSequenceClassification) on IMDB and register it. Demonstrates: - Using the same Model/Procedure pattern with a different training backend - Hyperparameter control via a simple `hyperparameters` table - How to keep specs deterministic (mocked) even when the real model is expensive to train

View example →

Want to contribute?

The examples repository is open source. Add your own examples or improve existing ones.