# 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](LICENSE) file for details.
## Contributing
Contributions are welcome! Please see [CONTRIBUTING.md](CONTRIBUTING.md) for details.
## Usage Examples
1. 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
```
```json
[
{
"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
}
]
```
2. Terminal commands classification:
```
'df -h' 'chown -R user:user /' -c 'safe' 'danger' 'neutral' -e "ls:safe" "rm:danger" "echo:neutral" --m gpt-4o-mini
```
```json
[
{
"content": "df -h",
"classification": "safe",
"score": 1.0
},
{
"content": "chown -R user:user /",
"classification": "danger",
"score": 1.0
}
]
```
3. Classify a tweet
```shell
classifai $tweet --classes 'AI' 'ASI' 'AGI' -m gpt-4o-mini
```
```json
[
{
"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
}
]
```
```shell
classifai $tweet --classes 'PROGRAMING' 'MACHINE-LEARNING' -m gpt-4o-mini
```
```json
[
{
"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
```bash
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
}
```
Raw data
{
"_id": null,
"home_page": "https://github.com/irthomasthomas/classifai",
"name": "classifai",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.6",
"maintainer_email": null,
"keywords": null,
"author": "Thomas Thomas",
"author_email": "irthomasthomas@Gmail.com",
"download_url": "https://files.pythonhosted.org/packages/c1/40/970823061f3ed27edd820a4c76e254862a3a7df6d7d2647a40a1d1a1b428/classifai-0.1.0.tar.gz",
"platform": null,
"description": "# Classifai\n\nClassifai 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.\n\n## Features\n\n- Easy-to-use command-line interface\n- Supports multiple classification categories\n- Utilizes advanced language models for high accuracy\n- Customizable prompts and examples\n- Supports both OpenAI and OpenRouter models\n\n## Installation\n\n```\npip install pipx\npipx install classifai\n```\n\n## Usage\n\n```\nclassifai [OPTIONS] CONTENT [CONTENT ...]\n```\n\nFor more details, run `classifai --help`.\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n\n## Contributing\n\nContributions are welcome! Please see [CONTRIBUTING.md](CONTRIBUTING.md) for details.\n\n## Usage Examples\n\n1. Multiple classification with Examples:\n ```\n 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\n ```\n ```json\n [\n {\n \"content\": \"news.ycombinator.com\",\n \"classification\": \"signal\",\n \"score\": 1.0\n },\n {\n \"content\": \"facebook.com\",\n \"classification\": \"noise\",\n \"score\": 1.0\n },\n {\n \"content\": \"ai.meta.com\",\n \"classification\": \"signal\",\n \"score\": 1.0\n }\n ]\n ```\n\n2. Terminal commands classification:\n ```\n 'df -h' 'chown -R user:user /' -c 'safe' 'danger' 'neutral' -e \"ls:safe\" \"rm:danger\" \"echo:neutral\" --m gpt-4o-mini\n ```\n ```json\n [\n {\n \"content\": \"df -h\",\n \"classification\": \"safe\",\n \"score\": 1.0\n },\n {\n \"content\": \"chown -R user:user /\",\n \"classification\": \"danger\",\n \"score\": 1.0\n }\n ]\n ```\n\n3. Classify a tweet\n ```shell\n classifai $tweet --classes 'AI' 'ASI' 'AGI' -m gpt-4o-mini\n ```\n ```json\n [\n {\n \"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.\",\n \"classification\": \"ASI\",\n \"score\": 1.0\n }\n ]\n ```\n ```shell\n classifai $tweet --classes 'PROGRAMING' 'MACHINE-LEARNING' -m gpt-4o-mini\n ```\n ```json\n [\n {\n \"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.\",\n \"classification\": \"MACHINE-LEARNING\",\n \"score\": 0.833334466588825\n }\n ]\n ```\n\n## Advanced scripts\n\n### Acting on the classification\n```bash\nclass-tweet() {\n local tweet=\"$1\"\n local threshold=0.2\n local class=\"MACHINE-LEARNING\"\n\n result=$(classifai \"$tweet\" --classes 'PROGRAMMING' 'MACHINE-LEARNING' -m gpt-4o-mini | jq -r '.[0] | select(.classification == \"'\"$class\"'\" and .score > '\"$threshold\"') | .classification')\n\n if [ -n \"$result\" ]; then\n echo \"Tweet classified as $class with high confidence. Executing demo...\"\n echo \"Demo: This is a highly relevant tweet about $class\"\n else\n echo \"Tweet does not meet classification criteria.\"\n fi\n}\n```\n\n\n",
"bugtrack_url": null,
"license": null,
"summary": "A command-line tool for AI-powered classification tasks using LLMs",
"version": "0.1.0",
"project_urls": {
"Homepage": "https://github.com/irthomasthomas/classifai"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "db6ce7ed7c219cbe60cb22d49d61fdcf4b930510de659351142bd9b944c1d410",
"md5": "d4718a8b2e1f25361f97019a6298d773",
"sha256": "ea039d646689580aefc276a65286339c56bb8cd613d870ee72150a140f869ab7"
},
"downloads": -1,
"filename": "classifai-0.1.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "d4718a8b2e1f25361f97019a6298d773",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.6",
"size": 2909,
"upload_time": "2024-09-01T23:24:41",
"upload_time_iso_8601": "2024-09-01T23:24:41.759601Z",
"url": "https://files.pythonhosted.org/packages/db/6c/e7ed7c219cbe60cb22d49d61fdcf4b930510de659351142bd9b944c1d410/classifai-0.1.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "c140970823061f3ed27edd820a4c76e254862a3a7df6d7d2647a40a1d1a1b428",
"md5": "6a03e6f4551139e6309c9ad073876dcf",
"sha256": "35b5341a267b0f404cd347f0c79856dee3900ed59413517ef6bfafbaf6351ace"
},
"downloads": -1,
"filename": "classifai-0.1.0.tar.gz",
"has_sig": false,
"md5_digest": "6a03e6f4551139e6309c9ad073876dcf",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6",
"size": 2721,
"upload_time": "2024-09-01T23:24:43",
"upload_time_iso_8601": "2024-09-01T23:24:43.337136Z",
"url": "https://files.pythonhosted.org/packages/c1/40/970823061f3ed27edd820a4c76e254862a3a7df6d7d2647a40a1d1a1b428/classifai-0.1.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-09-01 23:24:43",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "irthomasthomas",
"github_project": "classifai",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "classifai"
}