Skip to main content

Run text LLM prompts over a list of texts

Project description

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

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

ollama_batch-0.1.3.tar.gz (15.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ollama_batch-0.1.3-py3-none-any.whl (16.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: ollama_batch-0.1.3.tar.gz
  • Upload date:
  • Size: 15.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for ollama_batch-0.1.3.tar.gz
Algorithm Hash digest
SHA256 d7f826f937bba2e79d3115759b99fadfe31d7b84d70889c938d67927560f64d0
MD5 7f2f597a02e616fa5b2b3a95f566e899
BLAKE2b-256 c0037a33afb4a5ed2dc324e16a750186744d9c8738a24cca4662855a75b2b097

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ollama_batch-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 16.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for ollama_batch-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 1a4427f7fda72cd81acfcfcfea90be12bea4e553a5cd95225392ed12e538d86f
MD5 6009430f15a6c38dfe296d32aea7d718
BLAKE2b-256 6414f935c5666f22dddf40a5336719d1473e698149f94620c387cc999f734475

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