Guide: Classification Strategies
Intentgine offers two primary ways to understand text: Resolve and Classify. Choosing the right one improves accuracy and performance.
Resolve vs. Classify
Section titled “Resolve vs. Classify”| Feature | Resolve | Classify |
|---|---|---|
| Output | Structured Tool Call (JSON) | Label (String) |
| Input | Query + Tool Definitions | Text + Classes (inline or set) |
| Mechanism | Complex Reasoning | Categorization |
| Cost | 1 request | 1 request |
Note: Both operations cost the same. Choose based on your use case, not pricing.
Classification Sets
Section titled “Classification Sets”For best performance and cost savings, use Classification Sets instead of passing classes inline.
A Classification Set is a named, stored collection of classes attached to your App — similar to how Toolsets work for Resolve. When you use a Classification Set:
- Semantic caching is enabled — similar inputs return cached results.
- Batch deduplication kicks in — near-identical items in a batch are grouped and only classified once.
- Consistent cache keys — the content hash of the set ensures cache stability.
- Extraction (optional) — automatically split compound queries into individual sub-queries and classify each one.
Creating a Classification Set
Section titled “Creating a Classification Set”Register your classes once via the Console or API:
{ "name": "Sentiment Analysis", "signature": "sentiment-v1", "classes": [ { "label": "positive", "description": "Expresses satisfaction or happiness" }, { "label": "negative", "description": "Expresses dissatisfaction or frustration" }, { "label": "neutral", "description": "Neither positive nor negative" } ], "enable_extraction": false}Using a Classification Set
Section titled “Using a Classification Set”Reference it by signature in your API calls:
{ "data": "The food was okay but the service was slow.", "classification_set": "sentiment-v1"}Context
Section titled “Context”You can provide optional context to help the LLM make better classification decisions. This is useful when the same text could be classified differently depending on the situation.
{ "data": "It's running hot", "classification_set": "support-v1", "context": "Customer is reporting an issue with their laptop"}The context field is limited to 1,000 characters.
You can still pass inline classes for ad-hoc classification — this uses exact-match caching only, as before.
Extraction
Section titled “Extraction”Classification sets can optionally enable automatic extraction. When enabled, the LLM can detect compound queries and extract them into individual sub-queries, then classify each one. See the Classification Extraction Guide for details.
Use Cases
Section titled “Use Cases”When to use Resolve
Section titled “When to use Resolve”- You need to take an action based on input.
- You need to extract parameters (dates, names, numbers).
- The input is an instruction or command.
- Example: “Book a flight to Paris on Friday” ->
book_flight(dest="Paris", date="Friday")
When to use Classify
Section titled “When to use Classify”- You need to route a message.
- You want to know the sentiment.
- You need to tag data for analytics.
- Example: “This flight was terrible” ->
sentiment: negative - Example: “I need a refund” ->
department: billing
Pipeline Pattern
Section titled “Pipeline Pattern”A common pattern is to use Classify to route a request to the correct specific agent, then use Resolve within that agent context.
- Router: Classify “I need a refund” -> Label:
billing. - Handler: Load
billingtools. - Resolver: Resolve “I need a refund” using billing tools ->
create_refund_request().
This saves tokens because the Resolver only sees relevant billing tools, not every tool in your system.