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.3"
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)

PIP install from GitHub

To install directly from GitHub, use the following command

pip install "git+https://github.com/sergio-ildefonso/LLMWorker.git@v0.1.3"

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.3.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.

llmworker-0.1.3-py3-none-any.whl (6.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: llmworker-0.1.3.tar.gz
  • Upload date:
  • Size: 7.2 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.3.tar.gz
Algorithm Hash digest
SHA256 324379502cfd4415cf6b090b281bf7a627a71f7867d59b3bda193647b5c30f06
MD5 3a82957246db33887c16ab9299606b2f
BLAKE2b-256 20ba52b8bd91766a37e6446b84e5a9b0afb888f43fc36f4ae5f830c334e6226c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: llmworker-0.1.3-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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 720a69c8a6cc0cdc45720dc40bb99abd52acc4dc3a075189410555866ffbe5f3
MD5 e4b674ed07298e571354ba0a1fdf95f4
BLAKE2b-256 70ffb39a9dde5b3d4a8962ab485bff766e21ca78ad646d11f3150f6f0bef49a9

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