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.4.tar.gz (6.9 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.4-py3-none-any.whl (5.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: classer-0.0.4.tar.gz
  • Upload date:
  • Size: 6.9 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.4.tar.gz
Algorithm Hash digest
SHA256 4dd70a38f7821fbeef20dc3e87c0712a6f416065898c1e7b7f1cc291f894aa06
MD5 07a28ed973d233507732129a8c9512f1
BLAKE2b-256 04b14b549a81949f2c2a15e402b1616c44999efc3ba39a01a69605240be67e84

See more details on using hashes here.

File details

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

File metadata

  • Download URL: classer-0.0.4-py3-none-any.whl
  • Upload date:
  • Size: 5.9 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.4-py3-none-any.whl
Algorithm Hash digest
SHA256 e3ef6ed561a98ba2858e610c254a386177ae29e62dc209271cba822415ae3268
MD5 a128a7212ad40a714be0f61280d5e5bf
BLAKE2b-256 90b3bb599a72899483c97401219736b9563a81cc5b6ce68179428b47f8e3e838

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