SDK for LLM-powered apps that get cheaper/faster via model distillation
Top 50.4% on sourcepulse
Tanuki is a Python library for building LLM-powered applications with predictable, type-safe outputs and automatic cost/latency reductions. It targets developers seeking to integrate LLMs into their workflows as reliably as traditional functions, offering benefits like automatic model distillation for performance gains and test-driven alignment for behavioral consistency.
How It Works
Tanuki allows developers to decorate Python function stubs with @tanuki.patch
. When called, an LLM generates a response that is programmatically cast to the function's specified return type (e.g., Pydantic models, literals). Behavior is refined using @tanuki.align
decorated functions containing assert
statements, which serve as training data for model distillation. Over time, Tanuki trains smaller, specialized models to emulate the behavior of larger ones, reducing costs and latency by up to 90% and 80% respectively.
Quick Start & Requirements
pip install tanuki.py
or poetry add tanuki.py
.OPENAI_API_KEY
.Highlighted Details
assert
statements in @tanuki.align
functions to define and enforce LLM behavior, ensuring predictable outputs.Maintenance & Community
Licensing & Compatibility
Limitations & Caveats
1 year ago
1 day