Skip to main content

High-performance AI classification — <200ms latency, up to 100x cheaper, beats GPT-5 mini accuracy

Project description

classer

High-performance AI classification

<200ms latency · up to 100x cheaper · beats GPT-5 mini accuracy · self-calibrating accuracy · no prompt engineering

Installation

pip install classer

Quick Start

import classer

# Single-label classification
result = classer.classify(
    text="I can't log in and need a password reset.",
    labels=["billing", "technical_support", "sales", "spam"]
)
print(result.label)      # "technical_support"
print(result.confidence) # 0.94

# With descriptions for better accuracy
lead = classer.classify(
    text="We need a solution for 500 users, what's your enterprise pricing?",
    labels=["hot", "warm", "cold"],
    descriptions={
        "hot": "Ready to buy, asking for pricing or demo",
        "warm": "Interested but exploring options",
        "cold": "Just browsing, no clear intent"
    }
)
print(lead.label)  # "hot"

# Multi-label tagging
result = classer.tag(
    text="Breaking: Tech stocks surge amid AI boom",
    labels=["politics", "technology", "finance", "sports"],
    threshold=0.3
)
for t in result.labels:
    print(f"{t.label}: {t.confidence}")
# technology: 0.92
# finance: 0.78

Configuration

No API key is needed to get started. To unlock higher rate limits, get an API key from classer.ai/api-keys.

export CLASSER_API_KEY=your-api-key

Or configure programmatically:

from classer import ClasserClient

client = ClasserClient(
    api_key="your-api-key"
)

API Reference

classify(text, labels=None, classifier=None, descriptions=None, speed=None, cache=None)

Classify text into exactly one of the provided labels.

result = classer.classify(
    text="Text to classify",
    labels=["label1", "label2"],  # 1-200 possible labels
    descriptions={"label1": "Description for better accuracy"},
    speed="standard",   # "standard" (default, <1s) or "fast" (<200ms)
    cache=True          # Set to False to bypass cache. Default: True
)

result.label        # Selected label
result.confidence   # 0-1 confidence score
result.tokens       # Total tokens used
result.latency_ms   # Processing time in ms
result.cached       # Whether served from cache

tag(text, labels=None, classifier=None, descriptions=None, threshold=None, speed=None, cache=None)

Multi-label tagging — returns all labels above a confidence threshold.

result = classer.tag(
    text="Text to tag",
    labels=["label1", "label2"],  # 1-200 possible labels
    descriptions={"label1": "Description"},
    threshold=0.3,  # Default: 0.3
    speed="standard",  # "standard" (default, <1s) or "fast" (<200ms)
    cache=True      # Set to False to bypass cache. Default: True
)

for t in result.labels:
    print(f"{t.label}: {t.confidence}")

result.tokens       # Total tokens used
result.latency_ms   # Processing time in ms
result.cached       # Whether served from cache

Error Handling

from classer import ClasserError

try:
    result = classer.classify(text="hello", labels=["a", "b"])
except ClasserError as e:
    print(e.status)  # HTTP status code
    print(e.detail)  # Error detail from API

Documentation

Full API reference and guides at docs.classer.ai.

GitHub

github.com/classer-ai/classer-python

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

classer-0.0.5.tar.gz (7.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

classer-0.0.5-py3-none-any.whl (6.0 kB view details)

Uploaded Python 3

File details

Details for the file classer-0.0.5.tar.gz.

File metadata

  • Download URL: classer-0.0.5.tar.gz
  • Upload date:
  • Size: 7.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.12

File hashes

Hashes for classer-0.0.5.tar.gz
Algorithm Hash digest
SHA256 82e5c564079941a0d5fca4e90cd0330c3239ecf03f228927a8286868983ec01e
MD5 7785910f3bb3a7611a3bec6c1c03bf28
BLAKE2b-256 22999e9a34fe179ad1ace46d514789bdd975831273681f2df33c4b630b4e0405

See more details on using hashes here.

File details

Details for the file classer-0.0.5-py3-none-any.whl.

File metadata

  • Download URL: classer-0.0.5-py3-none-any.whl
  • Upload date:
  • Size: 6.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.12

File hashes

Hashes for classer-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 425e104882851dfaca279ed92bb8bf9431c2ebab32f90a9d275475975fbef092
MD5 abb99249e8a90edaa1f39b4fc2b12982
BLAKE2b-256 01b5e678ce6060624dba3cd21f27ccc3f6922400736f6eafb189e527bb940540

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page