Skip to main content

prompt-complexity-analyzer

ML-powered prompt complexity analyzer for LLM routing. Scores any prompt 1–10 and recommends the right model tier — no API calls, runs locally.

Install

pip install prompt-complexity-analyzer

Quick start

from prompt_complexity_analyzer import complexity

r = complexity("prove P≠NP")
print(r.score)    # 9.2
print(r.tier)     # capable
print(r.model)    # claude-opus-4-6
print(r)          # Score 9.2/10 | Tier: capable | Model: claude-opus-4-6 | Backend: ml
r.explain()       # full breakdown with dimension scores

Score tiers

Score Tier Models
1.0 – 3.5 fast claude-haiku-4-5 · gpt-4o-mini · gemini-2.0-flash
3.6 – 6.5 balanced claude-sonnet-4-6 · gpt-4o · gemini-2.0-pro
6.6 – 10.0 capable claude-opus-4-6 · o1 · gemini-2.5-pro

Providers

r = complexity("your prompt", provider="openai")    # gpt-4o-mini / gpt-4o / o1
r = complexity("your prompt", provider="google")    # gemini-2.0-flash / pro / 2.5-pro
r = complexity("your prompt", provider="ollama")    # qwen3:1.7b / 14b / 32b
r = complexity("your prompt", provider="anthropic") # default

Result object

r = complexity("Compare ECDH vs RSA for TLS 1.3")

r.score          # float 1–10
r.tier           # "fast" | "balanced" | "capable"
r.model          # recommended model string for the chosen provider
r.label          # "Fast / Lightweight" | "Balanced" | "High Capability"
r.backend        # "ml" | "heuristic"
r.dimensions     # {"Reasoning Depth": 8.5, "Domain Specificity": 9.0, ...}
r.flags          # advisory messages, e.g. ["⚠ Very high complexity"]

# Fuzzy key access — substring matches dimension names
r["reasoning"]   # Reasoning Depth score
r["domain"]      # Domain Specificity score
r["multi"]       # Multi-part score
r["ambiguity"]   # Ambiguity score
r["output"]      # Output Complexity score

# Serialization
r.to_dict()      # plain dict
r.to_json()      # JSON string

explain() output

  ────────────────────────────────────────────────────────────
  Score        8.1 / 10
  Tier         High Capability
  Model        claude-opus-4-6  [anthropic]
  Backend      ml
  Use when     Complex research, deep reasoning, ambiguous high-stakes tasks
  ────────────────────────────────────────────────────────────

  Dimension                Bar               Score
  ──────────────────────────────────────────────────────────
  Vocabulary               ████░░░░░░░░░░     4.5
  Multi-part               ████████░░░░░░     7.0
  Reasoning Depth          █████████░░░░░     8.5
  Domain Specificity       █████████░░░░░     9.0
  Ambiguity                ███░░░░░░░░░░░     2.0
  Output Complexity        █████░░░░░░░░░     4.5

CLI

# Full breakdown
prompt_complexity_analyzer -p "your prompt"

# Single field
prompt_complexity_analyzer --only score -p "your prompt"
prompt_complexity_analyzer --only tier -p "your prompt"
prompt_complexity_analyzer --only model -p "your prompt"
prompt_complexity_analyzer --only reasoning -p "your prompt"

# Provider
prompt_complexity_analyzer --provider openai -p "your prompt"

# JSON output
prompt_complexity_analyzer --json -p "your prompt"

# Stdin
echo "your prompt" | prompt_complexity_analyzer

Load a custom ML model

from prompt_complexity_analyzer import set_model, complexity

set_model("./my_model.joblib")   # call once at startup
r = complexity("your prompt")
print(r.backend)  # ml

# Or per-call
r = complexity("your prompt", model_path="./my_model.joblib")

Semantic embeddings

The package uses sentence-transformers (all-MiniLM-L6-v2) for higher-accuracy scoring. The embedding model loads automatically on import if sentence-transformers is installed (it is — it's a hard dependency). The first run downloads ~80MB, cached locally after that.

from prompt_complexity_analyzer import load_embedding_model, complexity

load_embedding_model()   # explicit load — optional, auto-loads on import
r = complexity("your prompt")

Feature dimensions

Dimension What it measures
Vocabulary Technical word length (binned)
Multi-part Subtask signals — "also", "furthermore", numbered steps
Reasoning Depth Keywords: analyze, prove, deduce, evaluate, compare…
Domain Specificity Math · Code · Security · Medical · Legal · Finance · Science
Ambiguity Vague qualifiers: "something", "maybe", "kind of"…
Output Complexity Structured output signals: JSON, essay, table, code block

Metadata

Release files for prompt-complexity-analyzer 0.1.1

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

Source distribution (sdist)

Source distribution for prompt-complexity-analyzer 0.1.1
File Size Uploaded Provenance Actions
prompt_complexity_analyzer-0.1.1.tar.gz 270.2 kB Without provenance Details for prompt_complexity_analyzer-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for prompt-complexity-analyzer 0.1.1
File Interpreter ABI Platform Actions
prompt_complexity_analyzer-0.1.1-py3-none-any.whl Python 3 none any Details for prompt_complexity_analyzer-0.1.1-py3-none-any.whl

Total release size: 545.9 kB

Release files / prompt_complexity_analyzer-0.1.1.tar.gz

Download URL prompt_complexity_analyzer-0.1.1.tar.gz
Size 270.2 kB
Tags Source
SHA-256 checksum
How to use checksums
df35f1c8c23c24767f74e4d4baccb79634bb2fa72daa1ac4fdeb6a84d80d58b2
BLAKE2b-256 checksum
How to use checksums
079c56343c0692a63bc592646ef779540030f82cb8a6c6bb21e239feee96b206
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.10

Release files / prompt_complexity_analyzer-0.1.1-py3-none-any.whl

Download URL prompt_complexity_analyzer-0.1.1-py3-none-any.whl
Size 275.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
23af0750c702b6abf231a2431fba298a5fa0b364f374789bc4a0593dccfef2b0
BLAKE2b-256 checksum
How to use checksums
9ba6e35b86f665a951510d1802c0fa8f174368a39eac1729252f61802957c9a1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.10

Security for prompt-complexity-analyzer 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files No provenance

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