llm-jq
Write and execute jq programs with the help of LLM
See Run a prompt to generate and execute jq programs using llm-jq for background on this project.
Installation
Install this plugin in the same environment as LLM.
llm install llm-jq
Usage
Pipe JSON directly into llm jq and describe the result you would like:
curl -s https://api.github.com/repos/simonw/datasette/issues | \
llm jq 'count by user.login, top 3'
Output:
[
{
"login": "simonw",
"count": 11
},
{
"login": "king7532",
"count": 5
},
{
"login": "dependabot[bot]",
"count": 2
}
]
group_by(.user.login) | map({login: .[0].user.login, count: length}) | sort_by(-.count) | .[0:3]
The JSON is printed to standard output, the jq program is printed to standard error.
Options:
-s/--silent: Do not print the jq program to standard error-o/--output: Output just the jq program, do not run it-v/--verbose: Show the prompt sent to the model and the response-m/--model X: Use a model other than the configured LLM default model-/--length X: Use a length of the input other than 1024 as the example
By default, the first 1024 bytes of JSON will be sent to the model as an example along with your description. You can use -l to send more or less example data.
Development
To set up this plugin locally, first checkout the code. Then create a new virtual environment:
cd llm-jq
python -m venv venv
source venv/bin/activate
Now install the dependencies and test dependencies:
llm install -e '.[test]'
To run the tests:
python -m pytest
Metadata
Release files for llm-jq 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| llm_jq-0.1.1.tar.gz | 8.2 kB | Without provenance | Details for llm_jq-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| llm_jq-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for llm_jq-0.1.1-py3-none-any.whl |
Total release size: 16.3 kB
Release files / llm_jq-0.1.1.tar.gz
| Download URL | llm_jq-0.1.1.tar.gz |
|---|---|
| Size | 8.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
db25d6fddedf70e2d71617aac2093ebf68f650406bfb2b743b465dfa1b147ee2
|
|
BLAKE2b-256 checksum How to use checksums |
700cba6423f81724ee2dfba1c3d26a487857d0ed9c9b898d58222497937bae9b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/5.1.1 CPython/3.12.7
|
Release files / llm_jq-0.1.1-py3-none-any.whl
| Download URL | llm_jq-0.1.1-py3-none-any.whl |
|---|---|
| Size | 8.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6b3f0a87784c29fcce079cd2c5c07aa2e2cb53a178a2ad3c951fc399f3375a78
|
|
BLAKE2b-256 checksum How to use checksums |
358ce681accf36bbbd53ac429013103bf572838bb509686d64f8420cb5b6eb94
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/5.1.1 CPython/3.12.7
|
Security for llm-jq 0.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.