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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
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 ollama_batch-0.1.2.tar.gz.
File metadata
- Download URL: ollama_batch-0.1.2.tar.gz
- Upload date:
- Size: 15.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8ef4e5bbd6ec11705dd00056087ffef99008a72221b2a3aad641b273b3d9d900
|
|
| MD5 |
7da5d9f01af542807a48ef6fbb353096
|
|
| BLAKE2b-256 |
1e0d3f6a5117e93c87570697702483ac3917883bc28eb02b86be7fd080cdf4c6
|
File details
Details for the file ollama_batch-0.1.2-py3-none-any.whl.
File metadata
- Download URL: ollama_batch-0.1.2-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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f88bb2645aa7c8cacee841f7b26b8f64988e2385aa01984b339afeea88f1a742
|
|
| MD5 |
30d16e12b165b4ded31d1582e6fd23f2
|
|
| BLAKE2b-256 |
65094c18e7f3c0859259177b015c9e440e01f66ba929dfc57c150ea564f83820
|