ggen is a command-line utility designed for generating outputs from structured prompts using AI models and grammars. It’s optimized for use both as a standalone command-line tool and within Unix-like pipelines, providing flexibility in various scripting and automation scenarios.
ggen features:
-
Flexibility: Suited for various input formats and customizable through templates and schemas.
-
Integration: Designed for seamless use in Unix pipelines and automated scripts.
-
Extensibility: Easily adaptable to different AI models and use-cases through configuration files.
-
Install
pipx
following The Official PipX instructions. -
Install ggen using pipx:
pipx install *.whl
Upon installation, ggen
is available as a command in your system.
Configuration is managed through JSON files, allowing detailed control over models, schemas, and prompt templates. These configurations can be overridden with command-line arguments.
Run ggen with:
ggen [options] [prompt]
Option | Description |
---|---|
|
Path to a JSON configuration file. Supports multiple files. |
|
Enable debug logging for verbose output. |
|
Path for the input prompt file. |
|
Path for the output file. Defaults to standard output if not specified. |
|
Name of the AI model. |
|
Path to the AI model directory. |
|
Name of the schema file for grammar. |
|
Path to the schema file directory. |
|
Name of the prompt template file. Defaults to 'instruct'. |
|
Path to the prompt template directory. |
+
The [prompt]
argument is the direct input for generation. It can be passed as a command-line argument if no input file is specified.
For detailed options, run ggen --help
.
Outputs are generated based on a combination of AI models, grammars defined in schema files, and structured prompts. This allows for high versatility in output generation, tailored to specific requirements.
Generate output using a specific configuration and input:
ggen -c config.json -i input.txt -o output.json
This command utilizes configurations from config.json
, reads the prompt from input.txt
, and writes the output to output.json
.
This tool is distributed under the GNU Affero General Public License, version 3 only. Consult the LICENSE file for more details.