batchwizard 0.1.0__tar.gz → 0.4.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (31) hide show
  1. batchwizard-0.4.0/.github/workflows/ci.yml +53 -0
  2. batchwizard-0.4.0/.github/workflows/publish.yml +33 -0
  3. batchwizard-0.4.0/.gitignore +162 -0
  4. batchwizard-0.4.0/PKG-INFO +248 -0
  5. batchwizard-0.4.0/README.md +218 -0
  6. batchwizard-0.4.0/pyproject.toml +78 -0
  7. batchwizard-0.4.0/src/batchwizard/__init__.py +16 -0
  8. batchwizard-0.4.0/src/batchwizard/cli.py +344 -0
  9. {batchwizard-0.1.0 → batchwizard-0.4.0}/src/batchwizard/config.py +12 -5
  10. batchwizard-0.4.0/src/batchwizard/models.py +61 -0
  11. batchwizard-0.4.0/src/batchwizard/processor.py +160 -0
  12. batchwizard-0.4.0/src/batchwizard/providers/__init__.py +19 -0
  13. batchwizard-0.4.0/src/batchwizard/providers/base.py +30 -0
  14. batchwizard-0.4.0/src/batchwizard/providers/openai.py +96 -0
  15. batchwizard-0.4.0/src/batchwizard/store.py +91 -0
  16. batchwizard-0.4.0/src/batchwizard/ui.py +143 -0
  17. {batchwizard-0.1.0 → batchwizard-0.4.0}/src/batchwizard/utils.py +16 -2
  18. batchwizard-0.4.0/tests/conftest.py +25 -0
  19. batchwizard-0.4.0/tests/test_openai_provider.py +141 -0
  20. batchwizard-0.4.0/tests/test_orchestrator.py +175 -0
  21. batchwizard-0.4.0/tests/test_store.py +69 -0
  22. batchwizard-0.4.0/uv.lock +627 -0
  23. batchwizard-0.1.0/PKG-INFO +0 -172
  24. batchwizard-0.1.0/README.md +0 -145
  25. batchwizard-0.1.0/pyproject.toml +0 -37
  26. batchwizard-0.1.0/src/batchwizard/__init__.py +0 -6
  27. batchwizard-0.1.0/src/batchwizard/cli.py +0 -191
  28. batchwizard-0.1.0/src/batchwizard/models.py +0 -18
  29. batchwizard-0.1.0/src/batchwizard/processor.py +0 -145
  30. batchwizard-0.1.0/src/batchwizard/ui.py +0 -250
  31. {batchwizard-0.1.0 → batchwizard-0.4.0}/LICENSE +0 -0
@@ -0,0 +1,53 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+
8
+ jobs:
9
+ lint:
10
+ runs-on: ubuntu-latest
11
+ steps:
12
+ - uses: actions/checkout@v4
13
+ with:
14
+ fetch-depth: 0
15
+ - uses: astral-sh/setup-uv@v5
16
+ - run: uv sync --group dev
17
+ - run: uv run ruff check src/
18
+ - run: uv run ruff format --check src/
19
+
20
+ test:
21
+ runs-on: ubuntu-latest
22
+ strategy:
23
+ matrix:
24
+ python-version: ["3.11", "3.12", "3.13"]
25
+ steps:
26
+ - uses: actions/checkout@v4
27
+ with:
28
+ fetch-depth: 0
29
+ - uses: astral-sh/setup-uv@v5
30
+ with:
31
+ python-version: ${{ matrix.python-version }}
32
+ - run: uv sync --group dev
33
+ # No test suite exists yet; run pytest only if tests/ appears.
34
+ # Remove the guard once tests land (Phase 2).
35
+ - run: |
36
+ if [ -d tests ]; then
37
+ uv run pytest tests/
38
+ else
39
+ echo "No tests directory yet — skipping."
40
+ fi
41
+
42
+ build:
43
+ runs-on: ubuntu-latest
44
+ steps:
45
+ - uses: actions/checkout@v4
46
+ with:
47
+ fetch-depth: 0
48
+ - uses: astral-sh/setup-uv@v5
49
+ - run: uv build
50
+ - uses: actions/upload-artifact@v4
51
+ with:
52
+ name: dist
53
+ path: dist/
@@ -0,0 +1,33 @@
1
+ name: Publish to PyPI
2
+
3
+ on:
4
+ release:
5
+ types: [published]
6
+
7
+ jobs:
8
+ build:
9
+ runs-on: ubuntu-latest
10
+ steps:
11
+ - uses: actions/checkout@v4
12
+ with:
13
+ fetch-depth: 0
14
+ - uses: astral-sh/setup-uv@v5
15
+ - run: uv build
16
+ - uses: actions/upload-artifact@v4
17
+ with:
18
+ name: dist
19
+ path: dist/
20
+
21
+ publish:
22
+ needs: build
23
+ runs-on: ubuntu-latest
24
+ environment: pypi
25
+ permissions:
26
+ # Required for PyPI Trusted Publishing (OIDC) — no API token needed
27
+ id-token: write
28
+ steps:
29
+ - uses: actions/download-artifact@v4
30
+ with:
31
+ name: dist
32
+ path: dist/
33
+ - uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,162 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ share/python-wheels/
24
+ *.egg-info/
25
+ .installed.cfg
26
+ *.egg
27
+ MANIFEST
28
+
29
+ # PyInstaller
30
+ # Usually these files are written by a python script from a template
31
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
32
+ *.manifest
33
+ *.spec
34
+
35
+ # Installer logs
36
+ pip-log.txt
37
+ pip-delete-this-directory.txt
38
+
39
+ # Unit test / coverage reports
40
+ htmlcov/
41
+ .tox/
42
+ .nox/
43
+ .coverage
44
+ .coverage.*
45
+ .cache
46
+ nosetests.xml
47
+ coverage.xml
48
+ *.cover
49
+ *.py,cover
50
+ .hypothesis/
51
+ .pytest_cache/
52
+ cover/
53
+
54
+ # Translations
55
+ *.mo
56
+ *.pot
57
+
58
+ # Django stuff:
59
+ *.log
60
+ local_settings.py
61
+ db.sqlite3
62
+ db.sqlite3-journal
63
+
64
+ # Flask stuff:
65
+ instance/
66
+ .webassets-cache
67
+
68
+ # Scrapy stuff:
69
+ .scrapy
70
+
71
+ # Sphinx documentation
72
+ docs/_build/
73
+
74
+ # PyBuilder
75
+ .pybuilder/
76
+ target/
77
+
78
+ # Jupyter Notebook
79
+ .ipynb_checkpoints
80
+
81
+ # IPython
82
+ profile_default/
83
+ ipython_config.py
84
+
85
+ # pyenv
86
+ # For a library or package, you might want to ignore these files since the code is
87
+ # intended to run in multiple environments; otherwise, check them in:
88
+ # .python-version
89
+
90
+ # pipenv
91
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
92
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
93
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
94
+ # install all needed dependencies.
95
+ #Pipfile.lock
96
+
97
+ # poetry
98
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
99
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
100
+ # commonly ignored for libraries.
101
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
102
+ #poetry.lock
103
+
104
+ # pdm
105
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
106
+ #pdm.lock
107
+ # pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
108
+ # in version control.
109
+ # https://pdm.fming.dev/latest/usage/project/#working-with-version-control
110
+ .pdm.toml
111
+ .pdm-python
112
+ .pdm-build/
113
+
114
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
115
+ __pypackages__/
116
+
117
+ # Celery stuff
118
+ celerybeat-schedule
119
+ celerybeat.pid
120
+
121
+ # SageMath parsed files
122
+ *.sage.py
123
+
124
+ # Environments
125
+ .env
126
+ .venv
127
+ env/
128
+ venv/
129
+ ENV/
130
+ env.bak/
131
+ venv.bak/
132
+
133
+ # Spyder project settings
134
+ .spyderproject
135
+ .spyproject
136
+
137
+ # Rope project settings
138
+ .ropeproject
139
+
140
+ # mkdocs documentation
141
+ /site
142
+
143
+ # mypy
144
+ .mypy_cache/
145
+ .dmypy.json
146
+ dmypy.json
147
+
148
+ # Pyre type checker
149
+ .pyre/
150
+
151
+ # pytype static type analyzer
152
+ .pytype/
153
+
154
+ # Cython debug symbols
155
+ cython_debug/
156
+
157
+ # PyCharm
158
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
159
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
160
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
161
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
162
+ #.idea/
@@ -0,0 +1,248 @@
1
+ Metadata-Version: 2.4
2
+ Name: batchwizard
3
+ Version: 0.4.0
4
+ Summary: BatchWizard: Manage OpenAI batch processing jobs with ease
5
+ Project-URL: Homepage, https://github.com/cmakafui/batchwizard
6
+ Project-URL: Repository, https://github.com/cmakafui/batchwizard
7
+ Project-URL: Issues, https://github.com/cmakafui/batchwizard/issues
8
+ Author: Carl Kugblenu
9
+ License-Expression: MIT
10
+ License-File: LICENSE
11
+ Keywords: async,batch,cli,openai
12
+ Classifier: Development Status :: 4 - Beta
13
+ Classifier: Environment :: Console
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: Operating System :: OS Independent
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Programming Language :: Python :: 3.13
19
+ Classifier: Programming Language :: Python :: 3.14
20
+ Requires-Python: >=3.11
21
+ Requires-Dist: aiofiles>=24.1
22
+ Requires-Dist: loguru>=0.7
23
+ Requires-Dist: openai>=1.37
24
+ Requires-Dist: pydantic-settings>=2.3
25
+ Requires-Dist: pydantic>=2.8
26
+ Requires-Dist: python-dotenv>=1.0
27
+ Requires-Dist: rich>=13.7
28
+ Requires-Dist: typer>=0.12
29
+ Description-Content-Type: text/markdown
30
+
31
+ # BatchWizard
32
+
33
+ BatchWizard is a powerful CLI tool for managing OpenAI batch processing jobs with ease. It provides functionalities to upload files, create batch jobs, check their status, and download the results. The tool uses asynchronous processing to efficiently handle multiple jobs concurrently.
34
+
35
+ ![image](https://github.com/user-attachments/assets/8084afbd-fd05-43b3-b57c-2ea1eb70a457)
36
+
37
+ ## Table of Contents
38
+
39
+ - [Installation](#installation)
40
+ - [Usage](#usage)
41
+ - [Configuration](#configuration)
42
+ - [Commands](#commands)
43
+ - [Features](#features)
44
+ - [Contributing](#contributing)
45
+ - [License](#license)
46
+
47
+ ## Installation
48
+
49
+ You can install BatchWizard using `pipx` for an isolated environment or directly via `pip`.
50
+
51
+ ### Using pipx (recommended)
52
+
53
+ ```bash
54
+ pipx install batchwizard
55
+ ```
56
+
57
+ ### Using pip
58
+
59
+ ```bash
60
+ pip install batchwizard
61
+ ```
62
+
63
+ Ensure you have `pipx` or `pip` installed on your system. For `pipx`, you can follow the installation instructions [here](https://pipx.pypa.io/stable/installation/).
64
+
65
+ ## Usage
66
+
67
+ BatchWizard provides a command-line interface (CLI) for managing batch jobs. Here are some example commands:
68
+
69
+ ### Process Batch Jobs
70
+
71
+ To process input files or directories:
72
+
73
+ ```bash
74
+ batchwizard process <input_paths>... [--output-directory OUTPUT_DIR] [--max-concurrent-jobs NUM] [--check-interval SECONDS]
75
+ ```
76
+
77
+ You can provide multiple input paths, which can be individual JSONL files or directories containing JSONL files.
78
+
79
+ #### Example with Sample Input
80
+
81
+ Let's say you have a file named `batchinput.jsonl` with the following content:
82
+
83
+ ```jsonl
84
+ {"custom_id": "request-1", "method": "POST", "url": "/v1/chat/completions", "body": {"model": "gpt-4o-mini", "messages": [{"role": "system", "content": "You are a helpful assistant."},{"role": "user", "content": "Hello world!"}],"max_tokens": 1000}}
85
+ {"custom_id": "request-2", "method": "POST", "url": "/v1/chat/completions", "body": {"model": "gpt-4o-mini", "messages": [{"role": "system", "content": "You are an unhelpful assistant."},{"role": "user", "content": "Hello world!"}],"max_tokens": 1000}}
86
+ ```
87
+
88
+ To process this file using BatchWizard:
89
+
90
+ 1. First, ensure your OpenAI API key is set:
91
+ ```bash
92
+ batchwizard configure --set-key YOUR_API_KEY
93
+ ```
94
+ 2. Then, run the process command:
95
+ ```bash
96
+ batchwizard process /path/to/batchinput.jsonl --output-directory /path/to/output
97
+ ```
98
+ This command will:
99
+ - Upload the `batchinput.jsonl` file to OpenAI
100
+ - Create a batch job
101
+ - Monitor the job status
102
+ - Download the results to the specified output directory when complete
103
+
104
+ You can also process multiple files or directories:
105
+
106
+ ```bash
107
+ batchwizard process /path/to/file1.jsonl /path/to/directory_with_jsonl_files /path/to/file2.jsonl
108
+ ```
109
+
110
+ ### Submit Without Blocking (fire and forget)
111
+
112
+ `process` blocks until every batch completes — which can take up to 24 hours. To submit and get your terminal back:
113
+
114
+ ```bash
115
+ batchwizard submit /path/to/inputs/ # or: batchwizard process ... --submit-only
116
+ ```
117
+
118
+ Submitted jobs are recorded in a local manifest (SQLite, in the BatchWizard config directory). Later — even after a reboot — reattach with:
119
+
120
+ ```bash
121
+ batchwizard watch [--output-directory OUTPUT_DIR]
122
+ ```
123
+
124
+ `watch` picks up every pending job from the manifest, polls until completion, and downloads the results.
125
+
126
+ ### Check Tracked Jobs
127
+
128
+ ```bash
129
+ batchwizard status [--all]
130
+ ```
131
+
132
+ Shows pending jobs from the local manifest (`--all` includes finished ones), with any failure reasons.
133
+
134
+ ### Failure Reasons and Error Files
135
+
136
+ When a batch fails, BatchWizard surfaces the provider's actual error (e.g. `insufficient_funds`, `invalid_request` with the offending line). When individual requests inside a batch fail, the per-request error file is downloaded alongside the results as `<batch_id>_errors.jsonl`.
137
+
138
+ ### Batch Endpoints
139
+
140
+ By default requests go to `/v1/chat/completions`. Use `--endpoint` on `process`/`submit` for other batch-capable endpoints such as `/v1/responses` or `/v1/embeddings`.
141
+
142
+ ### List Recent Jobs
143
+
144
+ To list recent batch jobs from the provider:
145
+
146
+ ```bash
147
+ batchwizard list-jobs [--limit NUM]
148
+ ```
149
+
150
+ ### Cancel a Job
151
+
152
+ To cancel a specific batch job:
153
+
154
+ ```bash
155
+ batchwizard cancel <job_id>
156
+ ```
157
+
158
+ ### Download Job Results
159
+
160
+ To download results for a completed batch job:
161
+
162
+ ```bash
163
+ batchwizard download <job_id> [--output-directory OUTPUT_DIR]
164
+ ```
165
+
166
+ This downloads the results file and, if any requests failed, the per-request error file.
167
+
168
+ ## Configuration
169
+
170
+ ### Setting up the OpenAI API Key
171
+
172
+ To set the OpenAI API key:
173
+
174
+ ```bash
175
+ batchwizard configure --set-key YOUR_API_KEY
176
+ ```
177
+
178
+ ### Show Current Configuration
179
+
180
+ To show the current configuration:
181
+
182
+ ```bash
183
+ batchwizard configure --show
184
+ ```
185
+
186
+ ### Reset Configuration
187
+
188
+ To reset the configuration to default values:
189
+
190
+ ```bash
191
+ batchwizard configure --reset
192
+ ```
193
+
194
+ ## Commands
195
+
196
+ BatchWizard supports the following commands:
197
+
198
+ - `process`: Submit batch jobs and wait for completion (add `--submit-only` to return immediately).
199
+ - `submit`: Submit batch jobs and exit; jobs are tracked in the local manifest.
200
+ - `watch`: Reattach to pending jobs, poll, and download results.
201
+ - `status`: Show jobs tracked in the local manifest.
202
+ - `configure`: Manage BatchWizard configuration.
203
+ - `list-jobs`: List recent batch jobs from the provider.
204
+ - `cancel`: Cancel a specific batch job.
205
+ - `download`: Download results (and error file) for a batch job.
206
+
207
+ For detailed information on each command, use the `--help` option:
208
+
209
+ ```bash
210
+ batchwizard <command> --help
211
+ ```
212
+
213
+ ## Features
214
+
215
+ - **Flexible Input**: Process individual JSONL files or entire directories containing JSONL files.
216
+ - **Asynchronous Processing**: Efficiently handle multiple batch jobs concurrently.
217
+ - **Rich UI**: Display progress and job status using a rich, interactive interface.
218
+ - **Flexible Configuration**: Easily manage API keys and other settings.
219
+ - **Job Management**: List, cancel, and download results for batch jobs.
220
+ - **Error Handling**: Robust error handling and informative error messages.
221
+
222
+ ## Contributing
223
+
224
+ We welcome contributions to BatchWizard! To contribute, follow these steps:
225
+
226
+ 1. Fork the repository.
227
+ 2. Create a new branch: `git checkout -b feature/your-feature-name`.
228
+ 3. Make your changes and commit them: `git commit -m 'Add some feature'`.
229
+ 4. Push to the branch: `git push origin feature/your-feature-name`.
230
+ 5. Open a pull request.
231
+
232
+ ### Running Tests
233
+
234
+ To run tests, use `pytest`:
235
+
236
+ ```bash
237
+ uv run pytest tests/
238
+ ```
239
+
240
+ Ensure your code passes all tests and meets the coding standards before opening a pull request.
241
+
242
+ ## License
243
+
244
+ This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.
245
+
246
+ ## Contact
247
+
248
+ For any questions or feedback, feel free to open an issue on the [GitHub repository](https://github.com/cmakafui/batchwizard).
@@ -0,0 +1,218 @@
1
+ # BatchWizard
2
+
3
+ BatchWizard is a powerful CLI tool for managing OpenAI batch processing jobs with ease. It provides functionalities to upload files, create batch jobs, check their status, and download the results. The tool uses asynchronous processing to efficiently handle multiple jobs concurrently.
4
+
5
+ ![image](https://github.com/user-attachments/assets/8084afbd-fd05-43b3-b57c-2ea1eb70a457)
6
+
7
+ ## Table of Contents
8
+
9
+ - [Installation](#installation)
10
+ - [Usage](#usage)
11
+ - [Configuration](#configuration)
12
+ - [Commands](#commands)
13
+ - [Features](#features)
14
+ - [Contributing](#contributing)
15
+ - [License](#license)
16
+
17
+ ## Installation
18
+
19
+ You can install BatchWizard using `pipx` for an isolated environment or directly via `pip`.
20
+
21
+ ### Using pipx (recommended)
22
+
23
+ ```bash
24
+ pipx install batchwizard
25
+ ```
26
+
27
+ ### Using pip
28
+
29
+ ```bash
30
+ pip install batchwizard
31
+ ```
32
+
33
+ Ensure you have `pipx` or `pip` installed on your system. For `pipx`, you can follow the installation instructions [here](https://pipx.pypa.io/stable/installation/).
34
+
35
+ ## Usage
36
+
37
+ BatchWizard provides a command-line interface (CLI) for managing batch jobs. Here are some example commands:
38
+
39
+ ### Process Batch Jobs
40
+
41
+ To process input files or directories:
42
+
43
+ ```bash
44
+ batchwizard process <input_paths>... [--output-directory OUTPUT_DIR] [--max-concurrent-jobs NUM] [--check-interval SECONDS]
45
+ ```
46
+
47
+ You can provide multiple input paths, which can be individual JSONL files or directories containing JSONL files.
48
+
49
+ #### Example with Sample Input
50
+
51
+ Let's say you have a file named `batchinput.jsonl` with the following content:
52
+
53
+ ```jsonl
54
+ {"custom_id": "request-1", "method": "POST", "url": "/v1/chat/completions", "body": {"model": "gpt-4o-mini", "messages": [{"role": "system", "content": "You are a helpful assistant."},{"role": "user", "content": "Hello world!"}],"max_tokens": 1000}}
55
+ {"custom_id": "request-2", "method": "POST", "url": "/v1/chat/completions", "body": {"model": "gpt-4o-mini", "messages": [{"role": "system", "content": "You are an unhelpful assistant."},{"role": "user", "content": "Hello world!"}],"max_tokens": 1000}}
56
+ ```
57
+
58
+ To process this file using BatchWizard:
59
+
60
+ 1. First, ensure your OpenAI API key is set:
61
+ ```bash
62
+ batchwizard configure --set-key YOUR_API_KEY
63
+ ```
64
+ 2. Then, run the process command:
65
+ ```bash
66
+ batchwizard process /path/to/batchinput.jsonl --output-directory /path/to/output
67
+ ```
68
+ This command will:
69
+ - Upload the `batchinput.jsonl` file to OpenAI
70
+ - Create a batch job
71
+ - Monitor the job status
72
+ - Download the results to the specified output directory when complete
73
+
74
+ You can also process multiple files or directories:
75
+
76
+ ```bash
77
+ batchwizard process /path/to/file1.jsonl /path/to/directory_with_jsonl_files /path/to/file2.jsonl
78
+ ```
79
+
80
+ ### Submit Without Blocking (fire and forget)
81
+
82
+ `process` blocks until every batch completes — which can take up to 24 hours. To submit and get your terminal back:
83
+
84
+ ```bash
85
+ batchwizard submit /path/to/inputs/ # or: batchwizard process ... --submit-only
86
+ ```
87
+
88
+ Submitted jobs are recorded in a local manifest (SQLite, in the BatchWizard config directory). Later — even after a reboot — reattach with:
89
+
90
+ ```bash
91
+ batchwizard watch [--output-directory OUTPUT_DIR]
92
+ ```
93
+
94
+ `watch` picks up every pending job from the manifest, polls until completion, and downloads the results.
95
+
96
+ ### Check Tracked Jobs
97
+
98
+ ```bash
99
+ batchwizard status [--all]
100
+ ```
101
+
102
+ Shows pending jobs from the local manifest (`--all` includes finished ones), with any failure reasons.
103
+
104
+ ### Failure Reasons and Error Files
105
+
106
+ When a batch fails, BatchWizard surfaces the provider's actual error (e.g. `insufficient_funds`, `invalid_request` with the offending line). When individual requests inside a batch fail, the per-request error file is downloaded alongside the results as `<batch_id>_errors.jsonl`.
107
+
108
+ ### Batch Endpoints
109
+
110
+ By default requests go to `/v1/chat/completions`. Use `--endpoint` on `process`/`submit` for other batch-capable endpoints such as `/v1/responses` or `/v1/embeddings`.
111
+
112
+ ### List Recent Jobs
113
+
114
+ To list recent batch jobs from the provider:
115
+
116
+ ```bash
117
+ batchwizard list-jobs [--limit NUM]
118
+ ```
119
+
120
+ ### Cancel a Job
121
+
122
+ To cancel a specific batch job:
123
+
124
+ ```bash
125
+ batchwizard cancel <job_id>
126
+ ```
127
+
128
+ ### Download Job Results
129
+
130
+ To download results for a completed batch job:
131
+
132
+ ```bash
133
+ batchwizard download <job_id> [--output-directory OUTPUT_DIR]
134
+ ```
135
+
136
+ This downloads the results file and, if any requests failed, the per-request error file.
137
+
138
+ ## Configuration
139
+
140
+ ### Setting up the OpenAI API Key
141
+
142
+ To set the OpenAI API key:
143
+
144
+ ```bash
145
+ batchwizard configure --set-key YOUR_API_KEY
146
+ ```
147
+
148
+ ### Show Current Configuration
149
+
150
+ To show the current configuration:
151
+
152
+ ```bash
153
+ batchwizard configure --show
154
+ ```
155
+
156
+ ### Reset Configuration
157
+
158
+ To reset the configuration to default values:
159
+
160
+ ```bash
161
+ batchwizard configure --reset
162
+ ```
163
+
164
+ ## Commands
165
+
166
+ BatchWizard supports the following commands:
167
+
168
+ - `process`: Submit batch jobs and wait for completion (add `--submit-only` to return immediately).
169
+ - `submit`: Submit batch jobs and exit; jobs are tracked in the local manifest.
170
+ - `watch`: Reattach to pending jobs, poll, and download results.
171
+ - `status`: Show jobs tracked in the local manifest.
172
+ - `configure`: Manage BatchWizard configuration.
173
+ - `list-jobs`: List recent batch jobs from the provider.
174
+ - `cancel`: Cancel a specific batch job.
175
+ - `download`: Download results (and error file) for a batch job.
176
+
177
+ For detailed information on each command, use the `--help` option:
178
+
179
+ ```bash
180
+ batchwizard <command> --help
181
+ ```
182
+
183
+ ## Features
184
+
185
+ - **Flexible Input**: Process individual JSONL files or entire directories containing JSONL files.
186
+ - **Asynchronous Processing**: Efficiently handle multiple batch jobs concurrently.
187
+ - **Rich UI**: Display progress and job status using a rich, interactive interface.
188
+ - **Flexible Configuration**: Easily manage API keys and other settings.
189
+ - **Job Management**: List, cancel, and download results for batch jobs.
190
+ - **Error Handling**: Robust error handling and informative error messages.
191
+
192
+ ## Contributing
193
+
194
+ We welcome contributions to BatchWizard! To contribute, follow these steps:
195
+
196
+ 1. Fork the repository.
197
+ 2. Create a new branch: `git checkout -b feature/your-feature-name`.
198
+ 3. Make your changes and commit them: `git commit -m 'Add some feature'`.
199
+ 4. Push to the branch: `git push origin feature/your-feature-name`.
200
+ 5. Open a pull request.
201
+
202
+ ### Running Tests
203
+
204
+ To run tests, use `pytest`:
205
+
206
+ ```bash
207
+ uv run pytest tests/
208
+ ```
209
+
210
+ Ensure your code passes all tests and meets the coding standards before opening a pull request.
211
+
212
+ ## License
213
+
214
+ This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.
215
+
216
+ ## Contact
217
+
218
+ For any questions or feedback, feel free to open an issue on the [GitHub repository](https://github.com/cmakafui/batchwizard).