Skip to main content

like itertools.batched but for calling LLM

Project description

BatchedLLM

like itertools.batched but for calling LLM

Ruff and Ty and PyTest checks

What? Why? How?

This is a wrapper for any async client to limit amount of concurent requests. More features are planned, like caching and budget restrictions.

Sometimes you work with large dataset and model with mixed reasoning where one requst responds immidiately while another waits for what feels like eternity. This tool helps you minimize time waiting while adding some usefull features, like error handling (more features are planned).

The principle behind is overwriting python attribute getters (getattrs) and call functions (call) and storing them till later evaluation. This also means that clients can change, but the tool doesn't need to. The intended use is for LLM clients to limit concurency, but, theoretically, and async object can be wrapped to limit its concurency and manage errors.

Example

Run the OpenAI speed comparison example with uv --script:

OPENAI_BASE_URL=<url or https://api.openai.com/v1> OPENAI_MODEL=<model or gpt-5-nano> OPENAI_API_KEY=sk-... uv run --script examples/openai_speed.py

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

batchedllm-0.3.0.tar.gz (20.2 kB view details)

Uploaded Source

Built Distribution

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

batchedllm-0.3.0-py3-none-any.whl (4.7 kB view details)

Uploaded Python 3

File details

Details for the file batchedllm-0.3.0.tar.gz.

File metadata

  • Download URL: batchedllm-0.3.0.tar.gz
  • Upload date:
  • Size: 20.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for batchedllm-0.3.0.tar.gz
Algorithm Hash digest
SHA256 80d0f2695c6dc4e1022f13972693c90be58376125b297900a3f1bf8923026d86
MD5 ee5e421aff5bac2505ad243690c81b01
BLAKE2b-256 05a812b027b122964f04e71483a09f8b7c101fad0e0f8a0dba9fce85d272e320

See more details on using hashes here.

Provenance

The following attestation bundles were made for batchedllm-0.3.0.tar.gz:

Publisher: release_and_publish.yml on batchedllm/batchedllm

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file batchedllm-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: batchedllm-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 4.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for batchedllm-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 55615ae984d8486467eaffa032b32dc9030323a49b96e00d9cc155e5fc5c0b7b
MD5 2da5ab226c49545332abfc0272807329
BLAKE2b-256 875d3d4138e75d76078d9b490af3007d021034983c15f4c2d2039a45731610b8

See more details on using hashes here.

Provenance

The following attestation bundles were made for batchedllm-0.3.0-py3-none-any.whl:

Publisher: release_and_publish.yml on batchedllm/batchedllm

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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