| 62 | type modelsCmdOption func(*config.RuntimeConfig) |
| 63 | |
| 64 | func newModelsCmd(opts ...modelsCmdOption) *cobra.Command { |
| 65 | cmd := &cobra.Command{ |
| 66 | Use: "models", |
| 67 | Short: "List available models", |
| 68 | Long: `List models available for use with --model flag. |
| 69 | |
| 70 | Shows models that can be passed to 'docker agent run --model' or |
| 71 | 'docker agent new --model'. By default shows models from providers |
| 72 | you have credentials for. Use --all to include all providers.`, |
| 73 | GroupID: "core", |
| 74 | } |
| 75 | |
| 76 | listCmd := newModelsListCmd(opts...) |
| 77 | cmd.AddCommand(listCmd) |
| 78 | |
| 79 | // Default to "list" when no subcommand given. |
| 80 | cmd.RunE = listCmd.RunE |
| 81 | |
| 82 | // Copy the flags from the list command so they work on the bare |
| 83 | // "docker agent models --provider openai" form as well. |
| 84 | cmd.Flags().AddFlagSet(listCmd.Flags()) |
| 85 | |
| 86 | return cmd |
| 87 | } |
| 88 | |
| 89 | func newModelsListCmd(opts ...modelsCmdOption) *cobra.Command { |
| 90 | var flags modelsListFlags |