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.1.tar.gz
(67.1 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.1.tar.gz.
File metadata
- Download URL: llm_wrapper_yl-0.1.1.tar.gz
- Upload date:
- Size: 67.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4e40923a60f4999768ff23985605802bfa28ba4d03a2f5a351af156ea310aada
|
|
| MD5 |
b24fb973779b8d32701e131a51fbb5ac
|
|
| BLAKE2b-256 |
189251ee695e9793d1d614f5f03934ebc538066cf77c84ec5d95bf2496deb034
|
File details
Details for the file llm_wrapper_yl-0.1.1-py3-none-any.whl.
File metadata
- Download URL: llm_wrapper_yl-0.1.1-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 |
1db4bc5cb5fa720135821949ad700909b37594fa740c824c15e3d5269d80fb69
|
|
| MD5 |
346f7d5ffac27bab890a7035788297b6
|
|
| BLAKE2b-256 |
6b546c0c9897d3c910c38162f2492fe09f2b8da26beb54c8c8b7a8eb9e8f6f3c
|