Extensible JSONL task editing library for code and formula inputs.
Project description
stress_csp_library
stress_csp_library processes JSON or JSONL task records, applies controlled line edits, runs edited variants through registered tools, evaluates tool outputs, and writes successful variants back as JSONL.
Features
- Dataclass-based record models with
extra_optionsfor forward-compatible schema changes. single_editmode for independent edits from the original input.cumulative_editmode for greedy accepted edits applied on top of prior edits.- Tool registry with in-memory tools and Python-file tool adapters.
- Configurable label comparison strategies for label-preserving and label-variation workflows.
- Minimal examples with a mock tool and mock editor.
Install
cd stress_csp_library
python3 -m pip install -e .[dev]
Run
python3 -m stress_csp_library.cli \
--input /path/to/tasks.jsonl \
--output /path/to/successes.jsonl \
--edit-mode single_edit \
--number-of-edits 3 \
--label-variation \
--single-edit-ids 0,2,4
number_of_edits accepts either a positive integer or "all".
- In
single_editmode, the library evaluates independent edits from the original input and saves up to the requested maximum number of successful premise-level edits. Use--single-edit-idsorextra_options.selected_edit_idsto restrict which editable units are considered. - In
cumulative_editmode,"all"means the runner walks the editable statements from first to last, tries the available operator edits for each statement against thelabel_variationcondition, applies the first acceptable edit, and then moves to the next statement. --no-label-variationis the default behavior: only save records whose tool output matches the original label.--label-variationinverts that rule: only save records whose tool output differs from the original label.
For csp_solver.py, provide the tool name in each record or via CLI defaults and point extra_options.tool_search_paths at the folder containing the solver. The Python-file adapter can call plain functions such as run(input_text) and also supports the CSP_Program class shape found in the source files.
Example Record
{
"id": "logical_deduction_0",
"tool": "csp_solver.py",
"input_type": "code",
"edit_mode": "single_edit",
"number_of_edits": 2,
"label_variation": false,
"expected_answer": "D",
"logic_program": "Domain:\n...\nConstraints:\nThe blue book is to the right of the yellow book. ::: blue_book > yellow_book\n...\n\nQuery:\n..."
}
Test
python3 -m pytest
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 stress_csp_library-0.1.5.tar.gz.
File metadata
- Download URL: stress_csp_library-0.1.5.tar.gz
- Upload date:
- Size: 16.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ceea8d2c4c0653f9f9624efdd8836258961df9ec4fb3dd1245b6637dcb3965a7
|
|
| MD5 |
87efe9799af50967f616971250b7a06f
|
|
| BLAKE2b-256 |
b511c91a82352887988f907b0cdfa02faa3cb61f9fbee59b9b4a79191f631b31
|
File details
Details for the file stress_csp_library-0.1.5-py3-none-any.whl.
File metadata
- Download URL: stress_csp_library-0.1.5-py3-none-any.whl
- Upload date:
- Size: 17.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ddce16fcae1566caae5e08c606a164ba76d0da308224f5bd8782376dfe4092f8
|
|
| MD5 |
eaeef3f5c848f27c6d96d260a9d4e9cf
|
|
| BLAKE2b-256 |
70eaa3fea9f372647f87baaf47b25b0d375ea9d439afd1919a96b4001b0271ce
|