Skip to main content

A lightweight Python toolkit for LLM text and image workflows with Ollama.

Project description

LLMWorker

LLMWorker is a minimal Python library to centralize LLM operations behind reusable workers.

Included Components

  • OllamaClient: low-level client for Ollama HTTP endpoints.
  • TextWorker: helper class for text generation/chat style requests.
  • ImageWorker: helper class for image generation requests.

Quick Start

bash scripts/bootstrap.sh
python scripts/demo.py

Build Package

bash scripts/build.sh

Check Package Name (PyPI)

Before publishing, validate that your package name is free:

python scripts/check_name.py llmworker

If it is taken, choose a new name (for example llmworker-sergio) and update it in pyproject.toml.

Install As A Package

Install from source (non-editable):

pip install .

Install from wheel artifact:

bash scripts/build.sh
pip install dist/*.whl

Install from PyPI (after you publish):

pip install llmworker

Install (editable)

pip install -e .

Publish To PyPI

bash scripts/publish.sh

Recommended release flow:

python scripts/check_name.py llmworker
bash scripts/build.sh
bash scripts/publish.sh

Basic Usage

from llmworker import OllamaClient, TextWorker, ImageWorker

client = OllamaClient(base_url="http://localhost:11434")
text_worker = TextWorker(client, model="llama3.2:3b")
image_worker = ImageWorker(client, model="x/flux2-klein:latest")

answer = text_worker.generate("Explain the origin of universe in one paragraph.")
print(answer)

Example image generation (model must support images)
img_result = image_worker.generate_image("A futuristic city at sunset")
print(img_result)

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

llmworker-0.1.0.tar.gz (7.0 kB view details)

Uploaded Source

Built Distribution

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

llmworker-0.1.0-py3-none-any.whl (6.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: llmworker-0.1.0.tar.gz
  • Upload date:
  • Size: 7.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.20

File hashes

Hashes for llmworker-0.1.0.tar.gz
Algorithm Hash digest
SHA256 a9f86c3172291e1d903caeb3c33d493046d00368cddd5889830f6443e0d75aae
MD5 bd30eaa0d600f5b207ff5c287668f9d2
BLAKE2b-256 d4262f005f46b7858c5aea59e346d1d26a76f2b3b543260424163c5e0564670a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: llmworker-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 6.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.20

File hashes

Hashes for llmworker-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 52dcdda3bfc8fda5f8c356d56f5a4f08dc8d3edbbb633f607009415d6335eb8f
MD5 ae83920f6c8592a7e853655499cc6658
BLAKE2b-256 216e2da2ddcdd834c00c9eb11f1c38b7f2f2a50ec87d6bc883bd40a6569d5ba0

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