🍋 Zest (zst1)
The Tangiest 1-Line AI Inference Wrapper for Python.
Why write 20 lines of boilerplate when you can just squeeze a model into one? zest provides a unified interface for local Hugging Face pipelines and cloud-based OpenRouter LLMs.
🚀 Quick Start
import zest
# Local Hugging Face (Sentiment Analysis)
print(zest.run("hf/distilbert-base-uncased-finetuned-sst-2-english", "I love this!"))
# Cloud OpenRouter (GPT-4o)
# Requires os.environ['OPENROUTER_API_KEY']
print(zest.run("or/openai/gpt-4o", "Explain quantum physics in one sentence."))
🛠 Available Routes
1. Hugging Face (hf/ prefix)
Uses the transformers library to run models locally on your CPU/GPU.
- Usage:
zest.run("hf/your-model-id", "input") - Restricted Models: If you need to access gated models (like Llama), set your token:
import os os.environ['HUGGINGFACE_TOKEN'] = 'your_token' # OR pass it directly: zest.run("hf/meta-llama/Llama-2-7b", "Hi", hf_token="your_token")
2. OpenRouter (or/ prefix)
Access 200+ LLMs via the OpenRouter API.
- Usage:
zest.run("or/google/gemini-pro-1.5", "Hello world") - Requirement: Set
os.environ['OPENROUTER_API_KEY'].
🛡️ Error Handling (The 'Damn' Level)
zest doesn't just crash. It catches:
- Prefix Errors: Forgot
hf/oror/? It'll tell you. - Auth Errors: Missing API keys for cloud or restricted models are clearly reported.
- Network Errors: Timeouts and HTTP errors from OpenRouter are intercepted.
- Model Errors: Invalid Hugging Face model IDs return specific config errors.
🧪 Snippets
Multi-turn Logic (Simplified):
model = "or/anthropic/claude-3-opus"
prompt = "Tell me a joke."
result = zest.run(model, prompt)
print(f"AI: {result}")
Batch Processing (Local):
inputs = ["Bad product", "Best ever! "]
results = [zest.run("hf/distilbert-base-uncased-finetuned-sst-2-english", x) for x in inputs]
Stay Tangy. 🍋
Metadata
Release files for zst1 0.0.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| zst1-0.0.4.tar.gz | 3.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| zst1-0.0.4-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 7.0 kB
Release files / zst1-0.0.4.tar.gz
| Download URL | zst1-0.0.4.tar.gz |
|---|---|
| Size | 3.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
27004fc2af434442fb89bd84ff130d4beaeb382c14e8850876f0718bb4aab6fa
|
|
BLAKE2b-256 checksum How to use checksums |
e601ce04e14768f84ccd4fe53a3b79743694215e4e20dbc3fd11124737892c07
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.13
|
Release files / zst1-0.0.4-py3-none-any.whl
| Download URL | zst1-0.0.4-py3-none-any.whl |
|---|---|
| Size | 3.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c61d48b2a67e04c4561b470b6dd3603a2632b78cfa83cf6473b274866a748bf1
|
|
BLAKE2b-256 checksum How to use checksums |
521fd334fd7293205b811ab8a346980ff316ab8db6f1c666712a9cf26a683906
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.13
|