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.

Download files

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

Source Distribution

moss_classify-0.1.0.tar.gz (10.0 kB view details)

Uploaded Source

Built Distribution

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

moss_classify-0.1.0-py3-none-any.whl (7.6 kB view details)

Uploaded Python 3

File details

Details for the file moss_classify-0.1.0.tar.gz.

File metadata

  • Download URL: moss_classify-0.1.0.tar.gz
  • Upload date:
  • Size: 10.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for moss_classify-0.1.0.tar.gz
Algorithm Hash digest
SHA256 017aa325737249633bcc4c93d2ad8d4f478fa64365048f33b768fd29e9ceb3ae
MD5 9f1fc14ea9e1cf20ac5fa278e0579862
BLAKE2b-256 b3f5adbb5312031001483ce669349c134c877fac8028e1e57be02c9d31c8cd88

See more details on using hashes here.

File details

Details for the file moss_classify-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: moss_classify-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 7.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for moss_classify-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c024817533654a9054b2d73842f920f9e912caa26ab93d0a46b26401c6958bd6
MD5 925a0c2ded4726f235364ae523f26a56
BLAKE2b-256 0ab87f5565c9ecd3deec881bc1408eec5c911e54d6688fdff38005b3a7f9b263

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 files

Supported by

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