Skip to main content

moss-classify

Python SDK for the Moss question classifier and normalizer service.

Installation

pip install moss-classify

Quick Start

import asyncio
from moss_classify_rest import MossClassifyClient

async def main():
    client = MossClassifyClient(
        project_id="your-project-id",
        project_key="your-project-key",
    )

    # Classify an utterance
    result = await client.classify("What is your pricing?")
    print(result.label)       # "question"
    print(result.confidence)  # 0.92
    print(result.is_question) # True

    # Classify + normalize with conversation context
    result = await client.classify(
        "you use aws right?",
        context=["Agent: We provide cloud infrastructure.", "Customer: yeah so like"],
    )
    print(result.normalized_question)  # "Do you use AWS?"

    await client.close()

asyncio.run(main())

Context Manager

async with MossClassifyClient(project_id="...", project_key="...") as client:
    result = await client.classify("What is the pricing?")

API Reference

MossClassifyClient(project_id, project_key, *, base_url, timeout)

Parameter Type Default Description
project_id str required Your Moss project ID
project_key str required Your Moss project key
base_url str https://service.usemoss.dev Service URL
timeout float 30.0 Request timeout in seconds

await client.classify(text, *, context) -> ClassifyResult

Parameter Type Default Description
text str required Utterance to classify
context list[str] None Conversation context for normalization

ClassifyResult

Field Type Description
label str Predicted label
confidence float Confidence (0-1)
is_question bool Shortcut for label == "question"
normalized_question str | None Cleaned question (when context provided)

Authentication

The client authenticates lazily on the first classify() call — it exchanges your project_id and project_key for a short-lived JWT token (1 hour). The token is cached and refreshed automatically before it expires. You can also call await client.init() to pre-authenticate.

Metadata

Release files for moss-classify 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for moss-classify 0.1.0
File Size Uploaded
moss_classify-0.1.0.tar.gz 10.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for moss-classify 0.1.0
File Interpreter ABI Platform
moss_classify-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 17.6 kB

Release files / moss_classify-0.1.0.tar.gz

Download URL moss_classify-0.1.0.tar.gz
Size 10.0 kB
Tags Source
SHA-256 checksum
How to use checksums
017aa325737249633bcc4c93d2ad8d4f478fa64365048f33b768fd29e9ceb3ae
BLAKE2b-256 checksum
How to use checksums
b3f5adbb5312031001483ce669349c134c877fac8028e1e57be02c9d31c8cd88
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.15

Release files / moss_classify-0.1.0-py3-none-any.whl

Download URL moss_classify-0.1.0-py3-none-any.whl
Size 7.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c024817533654a9054b2d73842f920f9e912caa26ab93d0a46b26401c6958bd6
BLAKE2b-256 checksum
How to use checksums
0ab87f5565c9ecd3deec881bc1408eec5c911e54d6688fdff38005b3a7f9b263
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.15

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page