A command-line tool for AI-powered classification tasks using LLMs
Project description
Classifai
Classifai is a powerful and user-friendly command-line tool for AI-powered classification tasks. It leverages the capabilities of large language models to provide accurate and efficient classification of various types of content.
Features
- Easy-to-use command-line interface
- Supports multiple classification categories
- Utilizes advanced language models for high accuracy
- Customizable prompts and examples
- Supports both OpenAI and OpenRouter models
Installation
pip install pipx
pipx install classifai
Usage
classifai [OPTIONS] CONTENT [CONTENT ...]
For more details, run classifai --help
.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Contributing
Contributions are welcome! Please see CONTRIBUTING.md for details.
Usage Examples
-
Multiple classification with Examples:
classifai 'news.ycombinator.com' 'facebook.com' 'ai.meta.com' --classes 'signal' 'noise' 'neutral' --examples "github.com:signal" "dailymail.com:noise" "arxiv.org:signal" "instagram.com:noise" "pintrest.com:noise" "anthropic.ai:signal" "stackoverflow.com:signal" "twitter.com:noise --model openrouter/openai/gpt-4-0314
[ { "content": "news.ycombinator.com", "classification": "signal", "score": 1.0 }, { "content": "facebook.com", "classification": "noise", "score": 1.0 }, { "content": "ai.meta.com", "classification": "signal", "score": 1.0 } ]
-
Terminal commands classification:
'df -h' 'chown -R user:user /' -c 'safe' 'danger' 'neutral' -e "ls:safe" "rm:danger" "echo:neutral" --m gpt-4o-mini
[ { "content": "df -h", "classification": "safe", "score": 1.0 }, { "content": "chown -R user:user /", "classification": "danger", "score": 1.0 } ]
-
Classify a tweet
classifai $tweet --classes 'AI' 'ASI' 'AGI' -m gpt-4o-mini
[ { "content": "Superintelligence is within reach.\n\nBuilding safe superintelligence (SSI) is the most important technical problem of our\u200b\u200b time.\n\nWe've started the world\u2019s first straight-shot SSI lab, with one goal and one product: a safe superintelligence.", "classification": "ASI", "score": 1.0 } ]
classifai $tweet --classes 'PROGRAMING' 'MACHINE-LEARNING' -m gpt-4o-mini
[ { "content": "Superintelligence is within reach.\n\nBuilding safe superintelligence (SSI) is the most important technical problem of our\u200b\u200b time.\n\nWe've started the world\u2019s first straight-shot SSI lab, with one goal and one product: a safe superintelligence.", "classification": "MACHINE-LEARNING", "score": 0.833334466588825 } ]
Advanced scripts
Acting on the classification
class-tweet() {
local tweet="$1"
local threshold=0.2
local class="MACHINE-LEARNING"
result=$(classifai "$tweet" --classes 'PROGRAMMING' 'MACHINE-LEARNING' -m gpt-4o-mini | jq -r '.[0] | select(.classification == "'"$class"'" and .score > '"$threshold"') | .classification')
if [ -n "$result" ]; then
echo "Tweet classified as $class with high confidence. Executing demo..."
echo "Demo: This is a highly relevant tweet about $class"
else
echo "Tweet does not meet classification criteria."
fi
}
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
classifai-0.1.0.tar.gz
(2.7 kB
view hashes)
Built Distribution
Close
Hashes for classifai-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ea039d646689580aefc276a65286339c56bb8cd613d870ee72150a140f869ab7 |
|
MD5 | d4718a8b2e1f25361f97019a6298d773 |
|
BLAKE2b-256 | db6ce7ed7c219cbe60cb22d49d61fdcf4b930510de659351142bd9b944c1d410 |