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

Don't forget to check / change the project version on pyproject.toml. (example:)

version = "0.1.2"
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.2.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.2-py3-none-any.whl (6.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: llmworker-0.1.2.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.2.tar.gz
Algorithm Hash digest
SHA256 2229d268ce252043e49496c7a97d5b8ce0c736f7a89123cec041e4588a8e2368
MD5 e31bcea5e530421534ad29050e2e7914
BLAKE2b-256 30a331f1602abb6801adc59bdb35b95c2d3ae3be4caeefcd29b1977ee6c34b54

See more details on using hashes here.

File details

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

File metadata

  • Download URL: llmworker-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 6.9 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 2fa95520805405625c303d5d340da89c966fbd048022c71ce91b2c4b24b47f70
MD5 68cc74b516ede93f86b5689613253579
BLAKE2b-256 b809067459fb0931418497de3786fe55f64d0961e6615c2490abbe7618be47b4

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