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

Attention: Need to have Ollama running with the selected models

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

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.4.tar.gz (6.9 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.4-py3-none-any.whl (6.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: llmworker-0.1.4.tar.gz
  • Upload date:
  • Size: 6.9 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.4.tar.gz
Algorithm Hash digest
SHA256 105d52f3b861391dd496c8d73263c5ebf2865f34a621cffc608a1aa8b0c88ec1
MD5 be2cc4de2f240e2532c8ada39701d88c
BLAKE2b-256 39cdaecf8da0b8457e9c4ff629bb1eb985ab488ead8bef91cd732f6d9abf5b02

See more details on using hashes here.

File details

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

File metadata

  • Download URL: llmworker-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 6.6 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.4-py3-none-any.whl
Algorithm Hash digest
SHA256 99d09f3b515ccef8140a901112324ac7b4bf4672c3086822bae0ea942eb57965
MD5 feee8482f1e1406efee57411b06defc4
BLAKE2b-256 5dafd1ab8bfee70cc76c93baadf7a7ea6086d1409c0019200a3ac8f44e43aa12

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