mirror of
https://github.com/lordmathis/llamactl.git
synced 2025-12-23 09:34:23 +00:00
Add ExtraArgs support for Llama, Mlx, and Vllm server options
This commit is contained in:
@@ -29,6 +29,10 @@ type MlxServerOptions struct {
|
||||
TopK int `json:"top_k,omitempty"`
|
||||
MinP float64 `json:"min_p,omitempty"`
|
||||
MaxTokens int `json:"max_tokens,omitempty"`
|
||||
|
||||
// ExtraArgs are additional command line arguments.
|
||||
// Example: {"verbose": "", "log-file": "/logs/mlx.log"}
|
||||
ExtraArgs map[string]string `json:"extra_args,omitempty"`
|
||||
}
|
||||
|
||||
func (o *MlxServerOptions) GetPort() int {
|
||||
@@ -57,13 +61,30 @@ func (o *MlxServerOptions) Validate() error {
|
||||
return validation.ValidationError(fmt.Errorf("invalid port range: %d", o.Port))
|
||||
}
|
||||
|
||||
// Validate extra_args keys and values
|
||||
for key, value := range o.ExtraArgs {
|
||||
if err := validation.ValidateStringForInjection(key); err != nil {
|
||||
return validation.ValidationError(fmt.Errorf("extra_args key %q: %w", key, err))
|
||||
}
|
||||
if value != "" {
|
||||
if err := validation.ValidateStringForInjection(value); err != nil {
|
||||
return validation.ValidationError(fmt.Errorf("extra_args value for %q: %w", key, err))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// BuildCommandArgs converts to command line arguments
|
||||
func (o *MlxServerOptions) BuildCommandArgs() []string {
|
||||
multipleFlags := map[string]struct{}{} // MLX doesn't currently have []string fields
|
||||
return BuildCommandArgs(o, multipleFlags)
|
||||
args := BuildCommandArgs(o, multipleFlags)
|
||||
|
||||
// Append extra args at the end
|
||||
args = append(args, convertExtraArgsToFlags(o.ExtraArgs)...)
|
||||
|
||||
return args
|
||||
}
|
||||
|
||||
func (o *MlxServerOptions) BuildDockerArgs() []string {
|
||||
|
||||
Reference in New Issue
Block a user