Skip to main content

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.2.tar.gz (67.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

llm_wrapper_yl-0.1.2-py3-none-any.whl (8.0 kB view details)

Uploaded Python 3

File details

Details for the file llm_wrapper_yl-0.1.2.tar.gz.

File metadata

  • Download URL: llm_wrapper_yl-0.1.2.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

Hashes for llm_wrapper_yl-0.1.2.tar.gz
Algorithm Hash digest
SHA256 5360a1aeb7c064608abbd8ba44ba61cda6be7d3ba3858a74d47305817da7a600
MD5 3e4c7880575dbdf8ac22a583a85e3731
BLAKE2b-256 6bee4519cbde169483e00a2476299ca201224a49daf97f34dafcb524188aae1b

See more details on using hashes here.

File details

Details for the file llm_wrapper_yl-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: llm_wrapper_yl-0.1.2-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

Hashes for llm_wrapper_yl-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 03acdc3547d177d8eefa6d455ac52a0352cd147ca27df694eee6f7c4faef3e1f
MD5 ed612bb86c7c1bd802c3b8c32bcbf970
BLAKE2b-256 4e47882499e942775bd05f4409cba113cbabef6eb7a6a700d367bf32d87c09cf

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page