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.
Basic Usage
from llmworker import OllamaClient, TextWorker, ImageWorker
TEXT_MODEL = "llama3.2:3b"
IMAGE_MODEL = "x/flux2-klein:latest"
OLLAMA_URL = "http://localhost:11434"
client = OllamaClient(base_url=OLLAMA_URL)
text_worker = TextWorker(client, model=TEXT_MODEL)
image_worker = ImageWorker(client, model=IMAGE_MODEL)
answer = text_worker.generate("Explain the origin of universe in one paragraph.")
print(answer)
image_options = {"width": 800, "height": 600}
img_result = image_worker.generate_image("A beach landscape at sunset", **image_options)
with open(f"image.png", "wb") as fw:
fw.write(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.5.tar.gz
(7.0 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file llmworker-0.1.5.tar.gz.
File metadata
- Download URL: llmworker-0.1.5.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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8b6322ecb5e8a883859d133ceaab9cc963267ebe8b65524a8d29edbdd1908c49
|
|
| MD5 |
9e4bba245e626aadd4654b43afc5f07d
|
|
| BLAKE2b-256 |
97d0d94c6786779699f5d1040bcda30f3a9bbb090fcf3752cd62a05be7a7c5bf
|
File details
Details for the file llmworker-0.1.5-py3-none-any.whl.
File metadata
- Download URL: llmworker-0.1.5-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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fe75b19c5bf798dde3367c66066501358e73bd010aff7d59698fee3e551f0edf
|
|
| MD5 |
e3e2ca9c5333840523f4fd93d5342025
|
|
| BLAKE2b-256 |
d354f1a2369da6dd802dd6652d7638d747b385c9654b3faf074e38b6757d904e
|