Skip to main content

Ollama Batch Classification Tool

This simple utility will runs LLM prompts over a list of texts or images for classify them, printing the results as a JSON response.

Quick start

Requirements

You'll need Ollama installed in your system.

Default model is gemma3:4b, but you can use any other model with the -m <model> parameter.

Install

pip install ollama-batch

Usage

ollama-batch -d examples/recipes -p 'Is this recipe a sweet dessert or salty food?'

Other examples

ollama-batch -d examples/recipes -p 'Is this recipe a sweet dessert or salty food?' --json-property=ingredients
ollama-batch -d examples/recipes -p 'Is this recipe a sweet dessert or salty food?' --json-property=title
ollama-batch -f examples/recipes.json --prompt-file examples/sweet_or_salty.txt
ollama-batch -f examples/recipes.json --prompt-file examples/sweet_or_salty.txt --json-append=title,url
ollama-batch -d examples/images -i --prompt-file examples/sweet_or_salty.txt

Help

ollama-batch \
    [--directory DIRECTORY] \
    [--file FILE] [--model MODEL] \
    [--prompt PROMPT] \
    [--prompt-file PROMPT_FILE] \
    [--json-property JSON_PROPERTY] \
    [--json-append JSON_APPEND] \
    [--question-first]

options:
  -h, --help
            Show this help message and exit
  --directory DIRECTORY, -d DIRECTORY
            Directory with files you want to process
  --file FILE, -f FILE
            JSON file you want to process
  --model MODEL, -m MODEL
            Model you want to use
  --prompt PROMPT, -p PROMPT
            Prompt text
  --prompt-file PROMPT_FILE
            Text file with a prompt
  --json-property JSON_PROPERTY
            JSON property that you want to use
  --json-append JSON_APPEND
            Property that you want to append to the results
  --question-first
            First the question, then the prompt
  --images, -i
            Look for images (use a vision model)

License

You may use this project under the terms of the GNU Affero General Public License (GNU AGPL) Version 3.

(c) 2024 Emilio Mariscal

Metadata

Release files for ollama-batch 0.1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ollama-batch 0.1.3
File Size Uploaded
ollama_batch-0.1.3.tar.gz 15.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ollama-batch 0.1.3
File Interpreter ABI Platform
ollama_batch-0.1.3-py3-none-any.whl Python 3 none any Details

Total release size: 31.9 kB

Release files / ollama_batch-0.1.3.tar.gz

Download URL ollama_batch-0.1.3.tar.gz
Size 15.4 kB
Tags Source
SHA-256 checksum
How to use checksums
d7f826f937bba2e79d3115759b99fadfe31d7b84d70889c938d67927560f64d0
BLAKE2b-256 checksum
How to use checksums
c0037a33afb4a5ed2dc324e16a750186744d9c8738a24cca4662855a75b2b097
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.3

Release files / ollama_batch-0.1.3-py3-none-any.whl

Download URL ollama_batch-0.1.3-py3-none-any.whl
Size 16.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1a4427f7fda72cd81acfcfcfea90be12bea4e553a5cd95225392ed12e538d86f
BLAKE2b-256 checksum
How to use checksums
6414f935c5666f22dddf40a5336719d1473e698149f94620c387cc999f734475
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.3

Release history Release notifications | RSS feed

This release

0.1.3 This release

2 release files

0.1.2

2 release files

0.1.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page