Skip to main content

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

Metadata

Release files for simple-infer 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for simple-infer 0.1.0
File Size Uploaded
simple_infer-0.1.0.tar.gz 33.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for simple-infer 0.1.0
File Interpreter ABI Platform
simple_infer-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 37.7 kB

Release files / simple_infer-0.1.0.tar.gz

Download URL simple_infer-0.1.0.tar.gz
Size 33.1 kB
Tags Source
SHA-256 checksum
How to use checksums
826a552a7e8e0d1d25e247364002fe4fe6553d2ae4733d359d025b7c79e15b1b
BLAKE2b-256 checksum
How to use checksums
df3ee7e8b3f51ae3de733347f2ffb1061a8d00172440b95cb242b891279665df
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 21, 2025.

Transparency log

Release files / simple_infer-0.1.0-py3-none-any.whl

Download URL simple_infer-0.1.0-py3-none-any.whl
Size 4.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9ed667c44b426cfabfa688bb42bede3fd54472b197fe1327dc99b9779e63d024
BLAKE2b-256 checksum
How to use checksums
3ee895b04cb3426ec7c993ddcaec21f881d13d3aea835551d3c63b91c0602f8f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 21, 2025.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page