@yogesh0333/yogiway-prompt
Version:
Free & Open Source Prompt Optimization Library - Save 30-50% on AI API costs. Multi-language, multi-platform support.
60 lines (42 loc) • 1.4 kB
Markdown
# YOGIWAY Prompt - Python Package
**Free & Open Source Prompt Optimization Library for Python**
## Installation
```bash
pip install yogiway-prompt
```
(Note: Package will be published to PyPI)
## Quick Start
```python
from yogiway_prompt import optimize, count, get_cost, get_savings
# Optimize a prompt
prompt = """
Please note that it is very important to understand that we need to
process this data carefully. It is absolutely essential that we handle
this with great care and attention to detail.
"""
result = optimize(prompt)
print(result['optimized'])
# "Process this data carefully. Handle with care and attention to detail."
print(f"Saved {result['reduction']['percentage']}% tokens")
# "Saved 45.2% tokens"
# Count tokens
tokens = count("Hello, world!", "openai")
print(tokens) # 3
# Calculate cost
cost = get_cost("Your prompt here", "openai", "gpt-4")
print(f"Cost: ${cost['total_cost']}")
# Calculate savings
original = "Very long prompt..."
optimized = optimize(original)['optimized']
savings = get_savings(original, optimized, "openai", "gpt-4", 1000)
print(f"Per day: ${savings['per_day']}")
print(f"Per year: ${savings['per_year']}")
```
## Features
- ✅ Token optimization (30-50% savings)
- ✅ Cost calculation
- ✅ Multi-provider support
- ✅ 100% Free
- ✅ Zero dependencies (pure Python)
## Documentation
See main README.md for full documentation.