A flexible wrapper for LLM providers with caching, async support, and cost tracking
Project description
LLM Wrapper
A flexible wrapper for LLM providers with caching, async support, and cost logging.
https://pypi.org/project/llm-wrapper-yl/
Installation
pip install llm-wrapper-yl
Quick Start
from llm_wrapper import Provider
# Initialize the provider
provider = Provider(model="gpt-4o-mini")
# Generate a single response
response = provider.generate("What is the capital of France?")
# Generate multiple responses with caching
responses = provider.generate(
["What is 2+2?", "What is the weather?"],
system_prompt="You are a helpful assistant.",
temperature=0.7
)
# For the second call, you will retrieve responses from cache
responses = provider.generate(
["What is 2+2?", "What is the weather?"],
system_prompt="You are a helpful assistant.",
temperature=0.7
)
Usage with Local Models
from llm_wrapper import Provider
# Initialize the provider with a local model
provider = Provider(
model="your-model-name",
host="your-server-host",
port=8000
)
# Generate responses
responses = provider.generate(["Your prompt here"])
Testing
# Install local package with test dependencies
uv pip install '.[test]'
# Run tests with output
python -m pytest -s tests
Deploying
hatch build
twine upload dist/*
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
llm_wrapper_yl-0.1.3.tar.gz
(67.2 kB
view details)
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 llm_wrapper_yl-0.1.3.tar.gz.
File metadata
- Download URL: llm_wrapper_yl-0.1.3.tar.gz
- Upload date:
- Size: 67.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7abcc3c1d29280451c3876966752e64f79bf464b72cac67c392599b892795a0d
|
|
| MD5 |
4299106cf7d59d10f05e2b7f405a8bb4
|
|
| BLAKE2b-256 |
05c0d08f5e88cbae27f84d2d5d72350911a0bde9bce69ac8614c4a0d6b727f94
|
File details
Details for the file llm_wrapper_yl-0.1.3-py3-none-any.whl.
File metadata
- Download URL: llm_wrapper_yl-0.1.3-py3-none-any.whl
- Upload date:
- Size: 8.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6cd516dfb6c58bac36ec39466214622e9b09938325f9424db88b5ef0b7a98d6d
|
|
| MD5 |
db6a154dc75f92d71beec8668e424539
|
|
| BLAKE2b-256 |
bcdcb90f684f7158fe7e5dbd580156972027e29f387f97175b02d1a2ba7d082c
|