LLM Quick Tools ⚡
A lightweight dual-purpose library for:
- Prompt Evaluation - Score and improve LLM inputs
- Mock LLM - Simulate API responses during development
Installation
pip install llm-quick-tools
1. Prompt Scoring 🔍
Evaluate prompt quality across multiple dimensions.
Quick Start
from llm_quick_tools import PromptEvaluator
evaluator = PromptEvaluator()
scores = evaluator.evaluate(
"Explain quantum computing to a 5-year-old",
task="education"
)
print(scores)
Output:
{
'length': 0.38, # Optimal 20-100 chars
'clarity': 0.9, # Sentence structure
'toxicity': 0.02, # Harmful content risk
'task_alignment': 0.8 # Relevance to education
}
Scoring Metrics
| Metric | Range | Ideal | Description |
|---|---|---|---|
| Length | 0-1 | 0.3-0.7 | Prompt character length |
| Clarity | 0-1 | >0.8 | Sentence complexity |
| Toxicity | 0-1 | <0.1 | Risk of harmful content |
| Task Alignment | 0-1 | >0.7 | Relevance to specified task |
2. Mock LLM 🤖
Simulate LLM responses without API calls.
Response Modes
from llm_quick_tools import MockLLM
# Initialize with different modes
echo_llm = MockLLM(mode="echo")
template_llm = MockLLM(mode="template")
Mode Comparison
| Mode | Description | Example Input → Output |
|---|---|---|
echo |
Repeats input | "Hi" → "Echo: Hi" |
random |
Random responses | "Help" → "Try checking our docs" |
template |
Keyword-triggered | "price" → "The cost is $9.99" |
Template Management
# Add custom templates
template_llm.add_template(
"contact support",
"Email us at help@company.com"
)
# Load from JSON
template_llm.load_templates("path/to/templates.json")
# Generate responses
print(template_llm.generate("How to contact support?"))
# Output: "Email us at help@company.com"
Pre-Loaded Templates
{
"hello": "Hi! How can I help?",
"goodbye": "Have a nice day!",
"pricing": "Our plans start at $9.99/mo",
"refund": "Refunds take 5-7 business days",
"tech support": "Try restarting your device"
}
Advanced Usage
Combined Workflow
# 1. Evaluate prompt
scores = evaluator.evaluate("Tell me a joke about AI")
# 2. Generate mock response
if scores['toxicity'] < 0.1:
response = template_llm.generate("Tell me a joke about AI")
else:
response = "I can't comply with that request"
Custom Template JSON
// custom_templates.json
{
"feature request": "Added to our roadmap",
"bug report": "We'll investigate this issue",
"order {} status": "Order #{} ships in 2 days"
}
Use Cases
- Testing - Verify LLM integration logic
- Development - Prototype before API integration
- Education - Teach prompt engineering concepts
- CI/CD - Run deterministic tests in pipelines
Contributing
- Fork the repository
- Create a feature branch (
git checkout -b feature/AmazingFeature) - Commit changes (
git commit -m 'Add feature') - Push (
git push origin feature/AmazingFeature) - Open a Pull Request
License
MIT © Aryan
Metadata
Release files for llm-quick-tools 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| llm_quick_tools-0.1.2.tar.gz | 5.6 kB | Without provenance | Details for llm_quick_tools-0.1.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| llm_quick_tools-0.1.2-py3-none-any.whl | Python 3 | none | any | Details for llm_quick_tools-0.1.2-py3-none-any.whl |
Total release size: 11.4 kB
Release files / llm_quick_tools-0.1.2.tar.gz
| Download URL | llm_quick_tools-0.1.2.tar.gz |
|---|---|
| Size | 5.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ed5ff9c2150e164114b57f379d7f7e816c88e34e5acd65c57bbbb603025b8d0d
|
|
BLAKE2b-256 checksum How to use checksums |
36e04771f7c334a6a241a5424ba06fe6f135aaae79054c46f15a021ba75f0d74
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.4
|
Release files / llm_quick_tools-0.1.2-py3-none-any.whl
| Download URL | llm_quick_tools-0.1.2-py3-none-any.whl |
|---|---|
| Size | 5.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3ec312241d4fd4a2bf955cb0cd903f4201536f0b424f0463cc44e51dfa05c405
|
|
BLAKE2b-256 checksum How to use checksums |
055c3c285fa3f6ad7bca81321996991555e548d43844434cbecd5281f038b3f3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.4
|
Security for llm-quick-tools 0.1.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.