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)
Important
Note: In some Ollama versions (probably, greater than 0.23.0), Ollama is not working stable with image models. It is adviseable to remove the unstable version of Ollama and install a stable version, in example: 0.23.0 Here are the steps to do it:
a) Uninstall Ollama:
-
Close the application
killall Ollama -
Remove the application and executable
sudo rm -rf /Applications/Ollama.app sudo rm /usr/local/bin/ollama
-
Clear cache and support data
rm -rf ~/Library/Application\ Support/Ollama rm -rf ~/Library/Caches/com.electron.ollama rm -rf ~/Library/Saved\ Application\ State/com.electron.ollama.savedState
-
(Optional) Delete downloaded templates
rm -rf ~/.ollama
b) Install Ollama Version 0.23.0:
-
Download the official Ollama binary
curl -L -o Ollama-darwin.zip https://github.com/ollama/ollama/releases/download/v0.23.0/Ollama-darwin.zip
(Or download manually from Ollama Releases)
-
Unzip into the Applications folder
unzip Ollama-darwin.zip -d /Applications/
(Or unzip and move the app to
/Applicationsmanually.) -
Delete the zip file to save disk space
rm Ollama-darwin.zip -
Create a global symlink for the
ollamacommandsudo ln -sf /Applications/Ollama.app/Contents/Resources/ollama /usr/local/bin/ollama
-
Remove macOS quarantine on the app
xattr -r -d com.apple.quarantine /Applications/Ollama.app
Metadata
Release files for llmworker 0.1.7
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| llmworker-0.1.7.tar.gz | 8.4 kB | Without provenance | Details for llmworker-0.1.7.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| llmworker-0.1.7-py3-none-any.whl | Python 3 | none | any | Details for llmworker-0.1.7-py3-none-any.whl |
Total release size: 15.6 kB
Release files / llmworker-0.1.7.tar.gz
| Download URL | llmworker-0.1.7.tar.gz |
|---|---|
| Size | 8.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a5d67b5424f871f69d57ab685dc9aba59ff6539b8d43383092a38d0726f46ccc
|
|
BLAKE2b-256 checksum How to use checksums |
b25ac6948e5147bfa5a7eaa2c7d0f60f1c7c4e7839a6f7d8a5d6eaa691256058
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.20
|
Release files / llmworker-0.1.7-py3-none-any.whl
| Download URL | llmworker-0.1.7-py3-none-any.whl |
|---|---|
| Size | 7.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
042b9898c858e34e0067aac10f00a6e4bba4f5ee565b49b2d7b11c7971032bf5
|
|
BLAKE2b-256 checksum How to use checksums |
664c6f37eaebf3e18b654e4a0ebe27730a966148355909e5c0350316bb21688f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.20
|
Security for llmworker 0.1.7
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.