Package Exports
- zerolabel
- zerolabel/dist/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (zerolabel) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
zerolabel
Zero-shot multimodal classification made simple.
What is zerolabel?
Zero-shot classification means you can classify text and images without training data. Just provide your labels and get instant predictions.
Instead of spending weeks training models, you write one line of code.
The Problem
Traditional classification requires:
- ❌ Collecting thousands of labeled examples
- ❌ Training models for hours/days
- ❌ Managing ML infrastructure
- ❌ Retraining when you want new labels
The Solution
import { classify } from 'zerolabel';
// Classify anything, instantly
const results = await classify({
texts: ['I love this product!'],
labels: ['positive', 'negative', 'neutral'],
inference_api_key: process.env.INFERENCE_API_KEY
});
console.log(results[0].predicted_label); // 'positive'That's it. No training, no infrastructure, no complexity.
⚡ Powered by inference.net
High-performance AI inference infrastructure
zerolabel uses Google Gemma 3-27B through inference.net - production-ready AI infrastructure that just works.
✨ What You Can Classify
📝 Text
await classify({
texts: ['This movie was incredible!'],
labels: ['positive review', 'negative review'],
inference_api_key: process.env.INFERENCE_API_KEY
});🖼️ Images
await classify({
images: [imageBase64],
labels: ['cat', 'dog', 'bird'],
inference_api_key: process.env.INFERENCE_API_KEY
});🔀 Both Together
await classify({
texts: ['Check out my new pet!'],
images: [petPhotoBase64],
labels: ['cute cat', 'cute dog', 'not cute'],
inference_api_key: process.env.INFERENCE_API_KEY
});🚀 Installation
npm install zerolabelGet your API key: inference.net
💡 Real Examples
Email Classification
const emails = [
'Meeting moved to 3pm',
'Your order has shipped!',
'URGENT: Account security alert'
];
const results = await classify({
texts: emails,
labels: ['meeting', 'order_update', 'security', 'spam'],
inference_api_key: process.env.INFERENCE_API_KEY
});Content Moderation
const result = await classify({
texts: ['User comment here...'],
labels: ['appropriate', 'inappropriate', 'needs_review'],
inference_api_key: process.env.INFERENCE_API_KEY
});Image Recognition
const result = await classify({
images: [productImageBase64],
labels: ['clothing', 'electronics', 'books', 'home_goods'],
inference_api_key: process.env.INFERENCE_API_KEY
});🎯 Why zerolabel?
| Traditional ML | zerolabel |
|---|---|
| ❌ Weeks of training | ✅ Instant results |
| ❌ Thousands of examples needed | ✅ Just provide labels |
| ❌ Expensive GPU infrastructure | ✅ Pay per prediction |
| ❌ Complex model management | ✅ One simple function |
| ❌ Fixed categories | ✅ Change labels anytime |
📊 Response Format
{
text: "I love this product!",
predicted_label: "positive",
confidence: 85.3,
probabilities: {
"positive": 0.853,
"negative": 0.097,
"neutral": 0.050
}
}🛠️ Advanced Usage
Custom Instructions
await classify({
texts: ['The API response time was 50ms'],
labels: ['technical', 'non-technical'],
criteria: 'Focus on technical complexity and jargon',
inference_api_key: process.env.INFERENCE_API_KEY
});Batch Processing
await classify({
texts: ['Comment 1', 'Comment 2', 'Comment 3'],
labels: ['positive', 'negative', 'neutral'],
inference_api_key: process.env.INFERENCE_API_KEY
});🔐 Environment Setup
# .env
INFERENCE_API_KEY=your_key_hereimport { classify } from 'zerolabel';
const results = await classify({
texts: ['Your text here'],
labels: ['label1', 'label2'],
inference_api_key: process.env.INFERENCE_API_KEY
});⚙️ Configuration
import { ZeroLabelClient } from 'zerolabel';
const client = new ZeroLabelClient({
inference_api_key: 'your-key',
maxRetries: 3 // Optional: retry failed requests
});
const results = await client.classify({
texts: ['Hello world'],
labels: ['greeting', 'question']
});🧠 How It Works
- Send your text/images → zerolabel
- zerolabel formats prompt → Google Gemma 3-27B via inference.net
- AI analyzes content → Returns predictions
- Get structured results → JSON with labels and confidence
No training required. The AI already understands your labels.
📝 TypeScript Support
Full type safety out of the box:
import type { ClassificationResult } from 'zerolabel';
const results: ClassificationResult[] = await classify({
texts: ['TypeScript is great!'],
labels: ['positive', 'negative'],
inference_api_key: process.env.INFERENCE_API_KEY
});🤝 Support & Community
- 🐛 Issues: GitHub Issues
- 📧 Email: contact@zerolabel.dev
- 🌐 Docs: zerolabel.dev
📄 License
MIT License - Build amazing things! 🚀