VOOZH about

URL: https://deepwiki.com/guanguans/ai-commit/7.4-generator-specific-configuration

⇱ Generator-Specific Configuration | guanguans/ai-commit | DeepWiki


Loading...
Menu

Generator-Specific Configuration

This document provides a complete reference for configuring individual AI generators in ai-commit. Each generator has its own configuration block within the generators array, containing driver specifications, authentication credentials, model parameters, and execution options.

For information about selecting and using generators during commit workflow, see AI Generators Overview. For details on the generator architecture and implementation patterns, see AI Generator System.

Configuration Structure

Each generator configuration follows a common structure but contains generator-specific options based on its integration pattern (API-based or CLI-based).

Generator Configuration to Runtime Instantiation Flow


Sources: config/ai-commit.php78-219 app/Generators/OpenAIGenerator.php26-29 app/Generators/BitoCliGenerator.php20-32 app/Commands/CommitCommand.php39-76

Configuration Access at Runtime


Sources: app/Commands/CommitCommand.php74-76 app/Generators/OpenAIGenerator.php26-29 app/Generators/BitoCliGenerator.php20-28

Common Configuration Keys

All generator configurations share these required keys:

KeyTypeDescription
driverstringGenerator driver identifier matching key in GeneratorManager::$drivers
parametersarrayGenerator-specific parameters passed to AI API or CLI process

API-based generators additionally include:

KeyTypeDescription
api_keystringAuthentication key for API access
http_optionsarrayGuzzle HTTP client options (proxy, timeout, etc.)

CLI-based generators additionally include:

KeyTypeDescription
binarystringPath or command name for CLI executable
optionsarrayCommand-line flags and their values

Sources: config/ai-commit.php78-219

API-Based Generators

API-based generators make HTTP requests to cloud-based AI services using SDK wrappers.

OpenAI Generator

The openai generator uses OpenAI's legacy completions API endpoint.

Configuration Block:


Parameters Reference

ParameterTypeDefaultDescriptionConfig Line
modelstringtext-davinci-003Model identifier. Options: text-davinci-003, text-davinci-002, text-curie-001, text-babbage-001, text-ada-001182
suffixstring|nullnullText appended after completion184
max_tokensinteger600Maximum tokens to generate185
temperaturefloat0.0Sampling temperature (0.0-2.0). Lower values = more deterministic186
top_pfloat1.0Nucleus sampling probability mass187
ninteger1Number of completions to generate188
streambooleantrueEnable streaming responses via buildWriter() closure189
logprobsinteger|nullnullInclude log probabilities in response190
echobooleanfalseEcho back the prompt in response191
stopstring|array|nullnullSequences where API stops generating192
presence_penaltyfloat0Penalty for new tokens (-2.0 to 2.0)193
frequency_penaltyfloat0Penalty for repeated tokens (-2.0 to 2.0)194
best_ofinteger1Generate N completions and return best195

Environment Variables:

  • OPENAI_API_KEY: API authentication key (line 180)

Implementation Details:

Sources: config/ai-commit.php178-198 app/Generators/OpenAIGenerator.php26-88

OpenAI Chat Generator

The openai_chat generator uses OpenAI's chat completions API endpoint, supporting GPT-3.5 and GPT-4 models.

Configuration Block:


Parameters Reference

ParameterTypeDefaultDescriptionConfig Line
modelstringgpt-3.5-turboModel identifier. Options: gpt-4, gpt-4-0613, gpt-4-32k, gpt-4-32k-0613, gpt-3.5-turbo, gpt-3.5-turbo-0613, gpt-3.5-turbo-16k, gpt-3.5-turbo-16k-0613206
max_tokensinteger600Maximum tokens to generate208
temperaturefloat0.0Sampling temperature (0.0-2.0)209
top_pfloat1.0Nucleus sampling probability mass210
ninteger1Number of chat completion choices211
streambooleantrueEnable streaming responses212
stopstring|array|nullnullUp to 4 sequences where API stops213
presence_penaltyfloat0Penalty for new topics (-2.0 to 2.0)214
frequency_penaltyfloat0Penalty for repetition (-2.0 to 2.0)215

HTTP Options: Configured at lines 201-203. Supports all Guzzle RequestOptions constants:

  • PROXY: Proxy server URL (example: 'https://proxy.com/v1')
  • TIMEOUT: Request timeout in seconds (global default: 120 at line 35)
  • VERIFY: SSL certificate verification (global default: false at line 33)
  • CONNECT_TIMEOUT: Connection timeout (global default: 30 at line 34)

Environment Variables:

  • OPENAI_API_KEY: API authentication key (line 204)

Sources: config/ai-commit.php32-218

Ernie Bot Generators

Baidu's Ernie Bot (文心一言) generators provide two model variants: ernie_bot and ernie_bot_turbo.

Configuration Block (ernie_bot):


Configuration Block (ernie_bot_turbo):


Parameters Reference

ParameterTypeDefaultDescriptionConfig Line
temperaturefloat0.95Sampling temperature affecting randomness110 / 123
top_pfloat0.8Nucleus sampling threshold111 / 124
penalty_scorefloat1.0Penalty for repeated content (1.0-2.0)112 / 125
streambooleantrueEnable streaming responses113 / 126

Authentication: Both generators require OAuth-based authentication with two credentials:

  • api_key: Baidu AI Cloud application API Key
  • secret_key: Used for access token generation via OAuth endpoint

The authentication flow exchanges API key and secret key for an access token before making generation requests.

Environment Variables:

  • ERNIE_API_KEY: API key for Baidu AI Cloud (lines 106, 119)
  • ERNIE_SECRET_KEY: Secret key for OAuth token generation (lines 107, 120)

Sources: config/ai-commit.php103-128

Moonshot Generator

The moonshot generator integrates with Moonshot AI (Kimi) services.

Configuration Block:


Parameters Reference

ParameterTypeDefaultDescriptionConfig Line
modelstringmoonshot-v1-8kModel identifier. Options: moonshot-v1-8k (8K context), moonshot-v1-32k (32K context), moonshot-v1-128k (128K context)166
max_tokensinteger600Maximum tokens to generate in response168
temperaturefloat0.0Sampling temperature (0.0-1.0). 0.0 = deterministic169
top_pfloat1.0Nucleus sampling probability threshold170
ninteger1Number of completion choices to generate171
streambooleantrueEnable Server-Sent Events (SSE) streaming172
stopstring|array|nullnullStop sequences for generation termination173
presence_penaltyfloat0Penalty for introducing new topics (-2.0 to 2.0)174
frequency_penaltyfloat0Penalty for token repetition (-2.0 to 2.0)175

HTTP Options: Configured at lines 161-163. Example proxy configuration commented out.

Environment Variables:

  • MOONSHOT_API_KEY: Moonshot API authentication key (line 164)

Sources: config/ai-commit.php159-177

CLI-Based Generators

CLI-based generators execute external command-line tools using Symfony Process.

CLI Generator Process Execution Flow


Configuration to Process Parameter Mapping:

Config KeyProcess Constructor ParameterDefaultDescription
parameters.cwd$cwdnullWorking directory
parameters.env$envnullEnvironment variables
parameters.timeout$timeout120Timeout in seconds
binary$command[0]VariesExecutable path
options$command[1...]VariesCLI flags

Sources: app/Generators/BitoCliGenerator.php20-32 app/Generators/GithubCopilotCliGenerator.php20-28 app/Generators/GithubModelsCliGenerator.php20-32 config/ai-commit.php97-157

Bito CLI Generator

The bito_cli generator integrates with the Bito CLI tool.

Configuration Block:


Configuration Keys

KeyTypeDefaultDescription
driverstringbito_cliGenerator driver identifier for GeneratorManager
binarystringbitoBito CLI executable path or command name resolved via env('BITO_CLI_BINARY')
prompt_filenamestringbito.promptTemporary file name for prompt storage during execution
optionsarraySee aboveCLI flags and their values passed to bito command
parametersarraySee belowSymfony Process constructor parameters

CLI Options

All options are nullable and defined at lines 83-95. When non-null, they are appended to the command via ensureWithOptions() method as --flag=value.

OptionDescriptionConfig Line
--contextContext information for the request84
--editEnable interactive editing mode85
--fileInput file path86
--helpDisplay help information87
--ignorePatterns to ignore during processing88
--keyAPI key override (if supported by Bito CLI)89
--listList available options or models90
--modelModel selection91
--promptPrompt override92
--temperatureTemperature setting for generation93
--versionDisplay version information94

Process Parameters

Configured at lines 97-101. Passed to Symfony\Component\Process\Process constructor.

ParameterTypeDefaultDescription
cwdstring|nullnullWorking directory for process execution
envarray|nullnullEnvironment variables array for subprocess
inputstring|nullnullInitial stdin input (overridden by setInput($prompt) at runtime)
timeoutinteger120Process timeout in seconds before termination

Command Construction: The generator constructs the command array by calling ensureWithOptions([$binary]) which appends non-null option values from the options array. The prompt is then passed via Process::setInput($prompt) at app/Generators/BitoCliGenerator.php29

Environment Variables:

  • BITO_CLI_BINARY: Override default binary path (line 81, default: 'bito')

Sources: config/ai-commit.php79-102 app/Generators/BitoCliGenerator.php20-32

GitHub Copilot CLI Generator

The github_copilot_cli generator uses GitHub CLI's Copilot extension.

Configuration Block:


Configuration Keys

KeyTypeDefaultDescription
driverstringgithub_copilot_cliGenerator driver identifier for GeneratorManager
binarystringghGitHub CLI executable path resolved via env('GITHUB_COPILOT_CLI_BINARY')
optionsarraySee aboveCLI flags for gh copilot explain command
parametersarraySee aboveSymfony Process constructor parameters

Command Structure

The generator constructs the command array as:


Executed via Symfony\Component\Process\Process.

CLI Options

Configured at lines 132-134. Options are appended via ensureWithOptions() method.

OptionDescriptionConfig Line
--hostnameGitHub Enterprise Server hostname for self-hosted instances133

Command Structure: The generator builds the command array as [$binary, 'copilot', 'explain', ...$options, $prompt] at app/Generators/GithubCopilotCliGenerator.php25 The prompt is passed as the final command argument, not via stdin.

Process Parameters: Configured at lines 136-140. Same structure as Bito CLI generator.

ParameterTypeDefaultDescription
cwdstring|nullnullWorking directory for gh CLI execution
envarray|nullnullEnvironment variables (must include GH_TOKEN)
inputstring|nullnullStdin input (unused, prompt passed as argument)
timeoutinteger120Process timeout in seconds

Environment Variables:

  • GITHUB_COPILOT_CLI_BINARY: Override default binary path (line 131, default: 'gh')
  • GH_TOKEN: GitHub authentication token required by gh CLI

Sources: config/ai-commit.php129-141 app/Generators/GithubCopilotCliGenerator.php20-28

GitHub Models CLI Generator

The github_models_cli generator uses GitHub CLI's models feature.

Configuration Block:


Configuration Keys

KeyTypeDefaultDescription
driverstringgithub_models_cliGenerator driver identifier for GeneratorManager
binarystringghGitHub CLI executable path resolved via env('GITHUB_MODELS_CLI_BINARY')
modelstringopenai/gpt-4.1-miniModel identifier resolved via env('GITHUB_MODELS_CLI_MODEL')
optionsarraySee aboveCLI flags for gh models run command
parametersarraySee aboveSymfony Process constructor parameters

Command Structure

The generator constructs the command array as:


The prompt is passed via stdin using Process::setInput($prompt).

CLI Options

Configured at lines 146-151. Options are appended via ensureWithOptions() method before stdin input.

OptionTypeDefaultDescriptionConfig Line
--max-tokensinteger|nullnullMaximum tokens to generate in response147
--system-promptstringYou are a git commit message generator.System prompt providing model context148
--temperaturefloat|nullnullSampling temperature for generation149
--top-pfloat|nullnullNucleus sampling probability threshold150

Command Structure: The generator builds the command array as [$binary, 'models', 'run', $model, ...$options] at app/Generators/GithubModelsCliGenerator.php27 The prompt is passed via stdin using Process::setInput($prompt) at line 29.

Model Configuration: The model parameter (line 145) specifies the AI model identifier in format provider/model-name. Default is openai/gpt-4.1-mini.

Process Parameters: Configured at lines 152-157. Same structure as other CLI generators.

ParameterTypeDefaultDescription
cwdstring|nullnullWorking directory for gh CLI execution
envarray|nullnullEnvironment variables (must include GH_TOKEN)
inputstring|nullnullInitial stdin (overridden by setInput($prompt))
timeoutinteger120Process timeout in seconds

Environment Variables:

  • GITHUB_MODELS_CLI_BINARY: Override default binary path (line 144, default: 'gh')
  • GITHUB_MODELS_CLI_MODEL: Override default model (line 145, default: 'openai/gpt-4.1-mini')
  • GH_TOKEN: GitHub authentication token required by gh CLI

Sources: config/ai-commit.php142-158 app/Generators/GithubModelsCliGenerator.php20-32

Configuration Hierarchy

Generator configurations are loaded and merged according to the four-tier priority system described in Configuration Management.

Configuration Loading and Merging Flow


Configuration Resolution Example:

For generator openai_chat:

  1. PHP defaults: config/ai-commit.php:199-218 (base: temperature: 0.0)
  2. Global JSON: ~/.ai-commit/.ai-commit.json (override: temperature: 0.5)
  3. Local JSON: ./.ai-commit.json (override: model: "gpt-4")
  4. CLI flag: --generator openai_chat (final selection)

Result: {model: "gpt-4", temperature: 0.5, ...} passed to OpenAIChatGenerator constructor.

Sources: app/Commands/CommitCommand.php39-215 app/Generators/OpenAIGenerator.php26-29

Environment Variable Support

All generator configurations support environment variable substitution using the env() helper function. This allows sensitive data like API keys to be stored outside the configuration file.

Common Environment Variables

VariableUsed ByPurpose
OPENAI_API_KEYopenai, openai_chatOpenAI API authentication
ERNIE_API_KEYernie_bot, ernie_bot_turboBaidu AI Cloud API key
ERNIE_SECRET_KEYernie_bot, ernie_bot_turboBaidu AI Cloud secret key
MOONSHOT_API_KEYmoonshotMoonshot AI API key
BITO_CLI_BINARYbito_cliBito CLI executable path
GITHUB_COPILOT_CLI_BINARYgithub_copilot_cliGitHub CLI executable path
GITHUB_MODELS_CLI_BINARYgithub_models_cliGitHub CLI executable path
GITHUB_MODELS_CLI_MODELgithub_models_cliDefault model identifier
GH_TOKENgithub_copilot_cli, github_models_cliGitHub authentication token

Setting Environment Variables:


Sources: config/ai-commit.php81-218

HTTP Options Configuration

API-based generators support HTTP client customization through the http_options array. These options are passed directly to the Guzzle HTTP client.

Global HTTP Options

Global HTTP options apply to all API-based generators unless overridden:


Generator-Specific HTTP Options

Individual generators can override global HTTP options:


Common HTTP Options

OptionTypeDescription
VERIFYboolean|stringSSL certificate verification. false disables, string provides CA bundle path
PROXYstring|arrayProxy server configuration
TIMEOUTfloatRequest timeout in seconds
CONNECT_TIMEOUTfloatConnection timeout in seconds
HEADERSarrayAdditional HTTP headers
DEBUGbooleanEnable debug output

Example - Using a Proxy:


Sources: config/ai-commit.php32-36 config/ai-commit.php161-163 config/ai-commit.php201-203

Configuration Management Commands

Generator configurations can be managed using the config command. See Configuration Management for complete documentation.

Examples:


Sources: app/Commands/CommitCommand.php200-215