Skip to content

Guide: Classification Strategies

Intentgine offers two primary ways to understand text: Resolve and Classify. Choosing the right one improves accuracy and performance.

FeatureResolveClassify
OutputStructured Tool Call (JSON)Label (String)
InputQuery + Tool DefinitionsText + Classes (inline or set)
MechanismComplex ReasoningCategorization
Cost1 request1 request

Note: Both operations cost the same. Choose based on your use case, not pricing.

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.

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
}

Reference it by signature in your API calls:

{
"data": "The food was okay but the service was slow.",
"classification_set": "sentiment-v1"
}

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.

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.

  • 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")
  • 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

A common pattern is to use Classify to route a request to the correct specific agent, then use Resolve within that agent context.

  1. Router: Classify “I need a refund” -> Label: billing.
  2. Handler: Load billing tools.
  3. 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.