Skip to main content

Minimal, hackable batch inference library for LLMs

Project description

simple-infer

Minimal, hackable batch inference library for LLMs. No batch endpoints needed.

Installation

pip install simple-infer

Usage

from simple_infer import infer

conversations = [
    [
        {"role": "system", "content": "You are a helpful assistant."},
        {"role": "user", "content": "What is the capital of France?"},
    ],
    [
        {"role": "system", "content": "You are a helpful assistant."},
        {"role": "user", "content": "What is 2+2?"},
    ]
]

results = infer(conversations, model="gpt-4.1-nano", max_concurrent=32)

Features

  • Simple: Two main functions - infer() and call_llm()
  • Fast: Async batch processing with configurable concurrency
  • Reliable: Built-in retries with exponential backoff
  • Hackable: Clean, readable code you can modify

Development

Setup

# Clone and install dependencies
uv sync --extra test --extra docs

# Copy environment template and add your OpenAI API key
cp .env.example .env
# Edit .env and add: OPENAI_API_KEY=your-key-here

Testing

# Run tests (requires OPENAI_API_KEY in environment)
export OPENAI_API_KEY=your-key-here
uv run pytest tests/ -v

# Or use .env file
uv run pytest tests/ -v

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

simple_infer-0.1.0.tar.gz (33.1 kB view details)

Uploaded Source

Built Distribution

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

simple_infer-0.1.0-py3-none-any.whl (4.6 kB view details)

Uploaded Python 3

File details

Details for the file simple_infer-0.1.0.tar.gz.

File metadata

  • Download URL: simple_infer-0.1.0.tar.gz
  • Upload date:
  • Size: 33.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for simple_infer-0.1.0.tar.gz
Algorithm Hash digest
SHA256 826a552a7e8e0d1d25e247364002fe4fe6553d2ae4733d359d025b7c79e15b1b
MD5 79a57b5aee7ee3bbfa5df4aade14e89e
BLAKE2b-256 df3ee7e8b3f51ae3de733347f2ffb1061a8d00172440b95cb242b891279665df

See more details on using hashes here.

Provenance

The following attestation bundles were made for simple_infer-0.1.0.tar.gz:

Publisher: python-publish.yml on sumukshashidhar/simple-infer

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

File details

Details for the file simple_infer-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: simple_infer-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 4.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for simple_infer-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9ed667c44b426cfabfa688bb42bede3fd54472b197fe1327dc99b9779e63d024
MD5 43835a73e2684536893f3646d2034e1c
BLAKE2b-256 3ee895b04cb3426ec7c993ddcaec21f881d13d3aea835551d3c63b91c0602f8f

See more details on using hashes here.

Provenance

The following attestation bundles were made for simple_infer-0.1.0-py3-none-any.whl:

Publisher: python-publish.yml on sumukshashidhar/simple-infer

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