Skip to content
/ ggen Public

Schema-aware and compliant generative AI tool for the unix commandline

License

Notifications You must be signed in to change notification settings

lee-b/ggen

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ggen: Generative AI Command-Line Tool

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.

Technical Benefits

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.

Prerequisites

  • Python 3.9 or higher.

Installation

  1. Install pipx following The Official PipX instructions.

  2. Install ggen using pipx:

    pipx install *.whl

Upon installation, ggen is available as a command in your system.

Configuration

Configuration is managed through JSON files, allowing detailed control over models, schemas, and prompt templates. These configurations can be overridden with command-line arguments.

Usage

Run ggen with:

ggen [options] [prompt]
Table 1. Options
Option Description

-c, --config-file

Path to a JSON configuration file. Supports multiple files.

--debug

Enable debug logging for verbose output.

-i, --input

Path for the input prompt file.

-o, --output

Path for the output file. Defaults to standard output if not specified.

-m, --model-name

Name of the AI model.

-M, --model-path

Path to the AI model directory.

-s, --schema-name

Name of the schema file for grammar.

-S, --schema-path

Path to the schema file directory.

-t, --prompt-template

Name of the prompt template file. Defaults to 'instruct'.

-T, --prompt-template-path

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.

Generating Output

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.

Example

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.

License

This tool is distributed under the GNU Affero General Public License, version 3 only. Consult the LICENSE file for more details.

Acknowledgments

Credits to the llama.cpp and llama-cpp-python libraries/toolkit contributors for their excellent project(s).

About

Schema-aware and compliant generative AI tool for the unix commandline

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages