Skip to main content

Async LLM backend abstraction with Retry-After aware clients.

Project description

llm-abstraction

Async LLM backend abstraction with shared Retry-After handling.

Only Mistral chat completions are implemented right now, but the package is structured around a generic async backend interface.

from llm_abstraction import MistralBackend

backend = MistralBackend(api_key="...")
response = await backend.chat(
    [
        {"role": "user", "content": "Hello"},
    ],
)
print(response.content)

embeddings = await backend.embed(["Hello"])
print(embeddings.embeddings[0])

Build

python -m venv .venv
source .venv/bin/activate
pip install -e ".[dev]"
pytest
ruff check .
mypy
pyright
python -m build
twine check dist/*

Publish

TestPyPI:

twine upload --repository testpypi dist/*

PyPI:

twine upload dist/*

After publishing, downstream projects can depend on:

llm-abstraction>=0.1.0

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_abstraction-0.2.0.tar.gz (7.2 kB view details)

Uploaded Source

Built Distribution

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

llm_abstraction-0.2.0-py3-none-any.whl (7.1 kB view details)

Uploaded Python 3

File details

Details for the file llm_abstraction-0.2.0.tar.gz.

File metadata

  • Download URL: llm_abstraction-0.2.0.tar.gz
  • Upload date:
  • Size: 7.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.1

File hashes

Hashes for llm_abstraction-0.2.0.tar.gz
Algorithm Hash digest
SHA256 b20205efbeb5e77c622ddaa888d2abca44f868a7bf4c6c98e6f30a8f87dcbba6
MD5 4c7cdbdf45d44964e086bd1373d19bed
BLAKE2b-256 2634dc19d92bd9208b71bffc735a8d8743cbf502b8bcbb24a54916603b63ead1

See more details on using hashes here.

File details

Details for the file llm_abstraction-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for llm_abstraction-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3c5ea31ba82e0fbb389b43a90ed5ff4062f3045c5d2ed1cf25ac03a95ecfc048
MD5 8c47d860c99aac6bb6cb8a418791bc79
BLAKE2b-256 259459ad513d071a62c1b96d6d680a1799113f59e8e3e14cf961336a46764780

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