Skip to content

Commit 16e0b9a

Browse files
committed
Add support for model selection via command line
- Modify `runOptions` to include a `model` field. - Update `run` function to use the specified model from options. - Add a new command-line flag for model selection. - Add relevant environment variable `AICOMMIT_MODEL`. Resolves #5
1 parent 230e4c8 commit 16e0b9a

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

cmd/aicommit/main.go

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ func run(inv *serpent.Invocation, opts runOptions) error {
127127
}
128128

129129
stream, err := opts.client.CreateChatCompletionStream(ctx, openai.ChatCompletionRequest{
130-
Model: openai.GPT4o,
130+
Model: opts.model,
131131
Stream: true,
132132
Temperature: 0,
133133
// Seed must not be set for the amend-retry workflow.
@@ -194,6 +194,7 @@ func run(inv *serpent.Invocation, opts runOptions) error {
194194

195195
type runOptions struct {
196196
client *openai.Client
197+
model string
197198
dryRun bool
198199
amend bool
199200
ref string
@@ -250,6 +251,15 @@ func main() {
250251
Env: "OPENAI_API_KEY",
251252
Value: serpent.StringOf(&openAIKey),
252253
},
254+
{
255+
Name: "model",
256+
Description: "The model to use, e.g. gpt-4o or gpt-4o-mini.",
257+
Flag: "model",
258+
FlagShorthand: "m",
259+
Default: "gpt-4o",
260+
Env: "AICOMMIT_MODEL",
261+
Value: serpent.StringOf(&opts.model),
262+
},
253263
{
254264
Name: "save-key",
255265
Description: "Save the OpenAI API key to persistent local configuration and exit.",

0 commit comments

Comments
 (0)