AnyAI - One-liner AI for everyone. A unified gateway to AI capabilities.
Project description
anyai
The unified gateway to the any* AI ecosystem — every AI task, one import.
anyai is the umbrella meta-package for the any* ecosystem. It provides a single import and a unified one-liner API for computer vision, OCR, LLMs, NLP, tabular ML, and deployment. The core package ships with zero heavy dependencies and includes useful rule-based implementations out of the box, while every sister package (anycv, anyocr, anyllm, anynlp, anyml, tableai, traincv, anydeploy, anyrobo) can be unlocked as an optional extra.
Built by Viet-Anh Nguyen at NRL.ai.
Why anyai?
- One-liner API — Get started in 3 lines of code for any AI task
- Plugin architecture — Discovers and delegates to installed
any*sister packages automatically - Local-first — Built-in rule-based methods work offline with no downloads
- Minimal core deps — Only
pillowandpyyamlrequired; heavy ML is optional - Production-ready — Type hints, tests, dataclass result types, graceful degradation
Installation
pip install anyai
For optional features:
pip install anyai[cv] # + anycv (object detection, classification)
pip install anyai[ocr] # + anyocr (text extraction from images)
pip install anyai[llm] # + anyllm (LLM abstraction layer)
pip install anyai[nlp] # + anynlp (NER, sentiment, summarization)
pip install anyai[ml] # + anyml (AutoML for tabular data)
pip install anyai[table] # + tableai (DataFrame profiling & cleaning)
pip install anyai[deploy] # + anydeploy (ONNX/TFLite export + serving)
pip install anyai[robo] # + anyrobo (voice agent framework)
pip install anyai[all] # everything
Python 3.8+ supported (tested on 3.8, 3.9, 3.10, 3.11, 3.12, 3.13)
Quick Start
import anyai
# 1. Text summarization (built-in, zero deps — extractive sentence scoring)
summary = anyai.summarize(
"Long article text here...",
max_sentences=3,
)
print(summary)
# 2. Sentiment analysis (built-in AFINN-style lexicon with negation handling)
sentiment = anyai.sentiment("I absolutely love this library!")
print(sentiment.label, sentiment.score) # "positive" 0.87
# 3. Keyword extraction (built-in TF-IDF-like scoring)
keywords = anyai.keywords("Machine learning is transforming software.", top_k=5)
# 4. Image metadata (built-in via Pillow)
info = anyai.image_info("photo.jpg")
print(info.width, info.height, info.format)
# 5. Delegated tasks (require sister packages)
labels = anyai.detect("photo.jpg") # needs anyai[cv]
text = anyai.ocr("scan.png") # needs anyai[ocr]
reply = anyai.chat("Explain RAG in 1 line.") # needs anyai[llm]
Models & Methods
Built-in (zero-dependency) implementations
| Task | Method | Notes |
|---|---|---|
summarize |
Extractive scoring: sentence position + word-frequency + length penalty | Pure Python, no models downloaded |
sentiment |
AFINN-style lexicon lookup with negation windows (not good -> negative) |
~2,500 scored English words baked in |
keywords |
TF-IDF-like term weighting with English stopword removal | No external corpus required |
image_info |
Pillow Image.open() + EXIF parsing |
Returns ImageMetadata dataclass |
pipeline |
Chain built-in and sister-package ops into a DAG | Lazy evaluation |
config |
YAML + environment variable resolver | Respects ANYAI_* env vars |
Delegated backends (via optional extras)
When you call a task that requires a sister package, anyai dynamically imports the registered backend:
anyai.detect / classify / segment-> anycv (YOLOv8 / MobileNetV2 / DeepLabV3 via ONNX Runtime)anyai.ocr-> anyocr (Surya / EasyOCR / PaddleOCR / Tesseract / Vision-LLM)anyai.chat / embed / tools-> anyllm (Ollama / llama.cpp / OpenAI / Anthropic / HF)anyai.ner / classify_text-> anynlpanyai.automl-> anyml (sklearn + XGBoost/LightGBM)anyai.profile_df / clean_df-> tableaianyai.export / serve-> anydeploy
API Reference
| Function | Purpose |
|---|---|
anyai.summarize(text, max_sentences=3) |
Extractive summary |
anyai.sentiment(text) |
SentimentResult(label, score) |
anyai.keywords(text, top_k=10) |
Ranked keyword list |
anyai.image_info(path) |
ImageMetadata dataclass |
anyai.detect(image, model="yolov8n") |
Object detection (requires [cv]) |
anyai.classify(image) |
Image classification (requires [cv]) |
anyai.ocr(image) |
Text extraction (requires [ocr]) |
anyai.chat(prompt, model="auto") |
LLM completion (requires [llm]) |
anyai.Pipeline([...]) |
Chain tasks across packages |
anyai.Config.from_yaml(path) |
Load project-wide config |
CLI Usage
anyai summarize article.txt --sentences 5
anyai sentiment "I really enjoyed the film"
anyai keywords document.txt --top 10
anyai info photo.jpg
anyai version
Examples
Build a pipeline that spans packages
from anyai import Pipeline
# Each step delegates to the right sister package (if installed)
pipe = Pipeline([
("ocr", {"backend": "auto"}), # anyocr
("summarize", {"max_sentences": 3}), # built-in
("sentiment", {}), # built-in
])
result = pipe.run("scanned_report.png")
print(result["summary"], result["sentiment"])
Use config-driven defaults
# anyai.yaml
llm:
provider: ollama
model: llama3.1:8b
cv:
model: yolov8n
import anyai
# All subsequent calls inherit these defaults
anyai.Config.load("anyai.yaml")
anyai.chat("Hello") # routed to ollama/llama3.1:8b
Graceful degradation
import anyai
# If anyllm is not installed, fall back to the built-in extractive summary
try:
summary = anyai.summarize_llm(long_text) # abstractive (needs anyai[llm])
except anyai.BackendNotAvailable:
summary = anyai.summarize(long_text) # extractive fallback (built-in)
License
MIT (c) Viet-Anh Nguyen
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 Distribution
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 anyai-0.2.4.tar.gz.
File metadata
- Download URL: anyai-0.2.4.tar.gz
- Upload date:
- Size: 41.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
40195c624c166e78c55bff043059e6ac914739b9e137b85b6e16ca5704b569e8
|
|
| MD5 |
7126570025b6a5163ae41a54b9132c39
|
|
| BLAKE2b-256 |
642b7850d88c6aa063c55153f5652a1b944abb95d26bfdbcf44960116d748293
|
File details
Details for the file anyai-0.2.4-py3-none-any.whl.
File metadata
- Download URL: anyai-0.2.4-py3-none-any.whl
- Upload date:
- Size: 32.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7b83cb81a140c27f2ad54cb5841746767203a648d901f5a55d16e8420d75a480
|
|
| MD5 |
c6d2c71506cc31aef1f9e514a7f8e3d8
|
|
| BLAKE2b-256 |
8cefafb199056be1b1acdbe452884031e2fef6e0179ab7b438353ecbe4d8ab69
|