A high-performance NLP evaluation metrics library with a Rust core.
Project description
BlazeMetrics
Supercharge your LLM and NLP evaluation, safety, and analytics with Rust-powered blazing speed.
Production-grade, plug-and-play, and battle-tested for enterprise and research LLM workflows.
Why BlazeMetrics?
- All-in-one evaluation: BLEU, ROUGE, WER, METEOR, and more—plus advanced analytics and real guardrail safety.
- Lightning fast: Core metrics run in Rust—perfect for millions of samples, parallel/async or streaming.
- Guardrails built-in: Blocklists, PII, regex, JSON schema, safety, and LLM-based factuality scoring.
- Enterprise-ready: Analytics, anomaly detection, dashboards, monitoring (Prometheus/StatsD), and instant reporting.
- Out-of-the-box for LLMs, RAG & agent workflows.
Deploy trust faster—for LLM startups, enterprise AI, researchers, and data science.
Features At a Glance
- State-of-the-art metrics (BLEU, ROUGE, WER, METEOR, CHRF, BERTScore & more)
- ️ Guardrails: Block unsafe content, redact PII, enforce custom policies with regex/JSON
- Streaming analytics: Outlier detection, trending, alerts for real-time eval
- LLM & RAG integration: Plug and play with OpenAI, Anthropic, LangChain, HuggingFace, code/agent ground truth, RAG
- Factuality/Judge: Hallucination & faithfulness scoring using LLM judges
- Production-scale speed: Rust core, easy parallelism and batch
- Dashboards & reporting: Instant model/data card, web dashboards (optional)
- Easy to extend: Custom guardrails, exporters, analytics for your workflow
Installation
Stable (CPU, core features):
pip install blazemetrics
with Dashboards/Monitoring/etc:
pip install "blazemetrics[dashboard]"
From source (for developers):
git clone https://github.com/2796gaurav/blazemetrics.git
cd blazemetrics
pip install -r requirements.txt
maturin develop
Quickstart: Get Bleeding-Edge Metrics in Seconds
Evaluate all key metrics in just 3 lines—no config required!
from blazemetrics import BlazeMetricsClient
candidates = ["The quick brown fox.", "Hello world!"]
references = [["The fast brown fox."], ["Hello world."]]
client = BlazeMetricsClient()
metrics = client.compute_metrics(candidates, references)
print(metrics) # {'rouge1_f1': [...], 'bleu': [...], ...}
print(client.aggregate_metrics(metrics)) # {'rouge1_f1': 0.85, ...}
Full LLM Workflow: Metrics, Guardrails, Analytics & Factuality — All in One
from blazemetrics import BlazeMetricsClient
from blazemetrics.llm_judge import LLMJudge # LLM-based scoring for factuality
# Your LLM generations and references
candidates = ["Alice's email is alice@example.com.", "2 + 2 is 5."]
references = [["Her email is alice@example.com."], ["2 + 2 = 4"]]
client = BlazeMetricsClient(
blocklist=["bitcoin"],
redact_pii=True,
regexes=[r"\\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,}\\b"],
enable_analytics=True,
metrics_lowercase=True,
)
# 1. Metrics
metrics = client.compute_metrics(candidates, references)
agg = client.aggregate_metrics(metrics)
# 2. Guardrail safety checks
violations = client.check_safety(candidates)
# 3. Analytics/trends
client.add_metrics(agg)
analytics = client.get_analytics_summary()
# 4. LLM-based factuality/hallucination (uses OpenAI, API key required)
judge = LLMJudge(provider="openai", api_key="YOUR_OPENAI_KEY", model="gpt-4o")
def factuality_scorer(output, reference):
result = judge.score([output], [reference])
return {"factuality": result[0].get("faithfulness", 0.0)}
client.set_factuality_scorer(factuality_scorer)
facts = client.evaluate_factuality(candidates, [r[0] for r in references])
# 5. Fancy model card report
model_card = client.generate_model_card("my-llm", metrics, analytics, config=vars(client.config), violations=violations, factuality=facts)
print(model_card)
Easy Integration: LLM, RAG, Agents, Guardrails, and More
- Use as a drop-in evaluation for HuggingFace, OpenAI, Anthropic, LangChain, code generation, and agentic workflows
- Proven RAG and semantic search/trace support:
semantic_search,agentic_rag_evaluate, provenance tracking - Real-time dashboards:
blazemetrics-dashboard(if installed with [dashboard]) - Built-in exporters for Prometheus, StatsD, CSV, and HTML reports
Advanced: Async, Parallel, Streaming, and Dashboard
- Parallel/async evaluation:
client.compute_metrics_parallel(...)andclient.compute_metrics_async(...) - Streaming analytics & alerting:
Add metrics sample-by-sample and get anomalies/trends in real time. - Instant dashboards:
Afterpip install "blazemetrics[dashboard]", run:blazemetrics-dashboard
Or, embed the dashboard server in your app/WSGI pipeline. - RAG/agent evaluation:
client.agentic_rag_evaluate(...)
API Overview (Unified Client)
BlazeMetricsClient config (selected):
- Metrics:
metrics_include,metrics_lowercase,metrics_stemming - Guardrails:
blocklist,regexes,redact_pii,case_insensitive - Analytics:
enable_analytics,analytics_window,analytics_alerts,analytics_anomalies - Monitoring/Exporters:
enable_monitoring,prometheus_gateway,statsd_addr - LLM config:
llm_provider,model_name - Performance:
parallel_processing,max_workers
See full docs or help(blazemetrics.BlazeMetricsClient) for every option!
Dashboards & Reporting
- Web dashboards: Instantly launch a web app for monitoring and reporting
- Instant model/data cards: Beautiful shareable markdown summaries for your models and datasets
- Export: Write HTML, CSV, Prometheus format, or push to cloud
Learn More
- Documentation
- Examples
- Advanced Usage: Analytics, Streaming, and Exporters
- RAG/Agent Evaluations
- Production & Compliance
Contribute & Community
- Star us on GitHub
- Open issues/feature requests, or create a PR!
- Join the discussion and help evolve LLM benchmarking and safety together.
License
MIT
BlazeMetrics 2025 Gaurav
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
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file blazemetrics-0.1.5.tar.gz.
File metadata
- Download URL: blazemetrics-0.1.5.tar.gz
- Upload date:
- Size: 4.5 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.9.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d9b45de83731b76ddf28f96b5dfc87d0b2ada22eb96de8d71de83ad1aaf33f04
|
|
| MD5 |
f221a92eac65375eb63d53a000142177
|
|
| BLAKE2b-256 |
18c37b0df28e3252781ced216c86df75b7b3a63bbfe3fae0634f9e4a5a7b3f23
|
File details
Details for the file blazemetrics-0.1.5-cp38-abi3-win_amd64.whl.
File metadata
- Download URL: blazemetrics-0.1.5-cp38-abi3-win_amd64.whl
- Upload date:
- Size: 1.4 MB
- Tags: CPython 3.8+, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.9.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c330fa1ed3d2eb9dd9174c506ee622becba902a1106f6f1ef3d49f0b38d6427b
|
|
| MD5 |
70f9470beccef4257f5a4db4f4354fdc
|
|
| BLAKE2b-256 |
2e565bcf645f9cfcc4824ae4852b028104807cd0017c14ff93562355aec8e26c
|
File details
Details for the file blazemetrics-0.1.5-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: blazemetrics-0.1.5-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 1.6 MB
- Tags: CPython 3.8+, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.9.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b4650a5af33de074f11778124a5c66b7f03f35c695ac31b474143228b1aea91f
|
|
| MD5 |
35a89bf455015d99370d4025ec8c0e81
|
|
| BLAKE2b-256 |
ad0456df6ebb888cdb46b985d06217acfec5d249d937e789c9059a3780179d05
|
File details
Details for the file blazemetrics-0.1.5-cp38-abi3-macosx_11_0_arm64.whl.
File metadata
- Download URL: blazemetrics-0.1.5-cp38-abi3-macosx_11_0_arm64.whl
- Upload date:
- Size: 1.4 MB
- Tags: CPython 3.8+, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.9.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
aafe9c71f30f1f0f1c9d9665dca3d6de8bf8c6bf96c92383bf43320d1ed6fb22
|
|
| MD5 |
3ba9036d7ecff44fdbb83952a3d18e3f
|
|
| BLAKE2b-256 |
676d1b54863564b2632687493f62606cbfe04e2a3cb72c4d5c73374e308b9238
|