|
1 | 1 | package localaitools |
2 | 2 |
|
3 | | -import "github.com/mudler/LocalAI/core/services/voiceprofile" |
| 3 | +import ( |
| 4 | + "github.com/mudler/LocalAI/core/services/nodes" |
| 5 | + "github.com/mudler/LocalAI/core/services/voiceprofile" |
| 6 | +) |
4 | 7 |
|
5 | 8 | // DTOs for the LocalAIClient interface. Where the same shape already exists |
6 | 9 | // elsewhere (config.Gallery, gallery.Metadata, schema.KnownBackend, |
@@ -115,6 +118,31 @@ type SetNodeVRAMBudgetRequest struct { |
115 | 118 | Budget string `json:"budget,omitempty" jsonschema:"VRAM allocation cap as a percentage (e.g. 80%) or absolute amount (e.g. 12GB). Empty string clears the override."` |
116 | 119 | } |
117 | 120 |
|
| 121 | +// ModelSchedulingConfig is the REST/MCP wire shape for one per-model |
| 122 | +// distributed scheduling rule. The NodeSelector field is a JSON object encoded |
| 123 | +// as a string, matching /api/nodes/scheduling responses. |
| 124 | +type ModelSchedulingConfig = nodes.ModelSchedulingConfig |
| 125 | + |
| 126 | +// SetSchedulingRequest is the input for set_scheduling. It mirrors |
| 127 | +// /api/nodes/scheduling so standalone MCP and REST callers preserve the same |
| 128 | +// PATCH-style semantics for the optional prefix-cache routing fields. |
| 129 | +type SetSchedulingRequest struct { |
| 130 | + ModelName string `json:"model_name" jsonschema:"Installed model name whose distributed scheduling rule should be created or updated."` |
| 131 | + NodeSelector map[string]string `json:"node_selector,omitempty" jsonschema:"Optional node-label selector. Empty means any healthy backend node."` |
| 132 | + MinReplicas int `json:"min_replicas" jsonschema:"Minimum desired replicas. Mutually exclusive with spread_all."` |
| 133 | + MaxReplicas int `json:"max_replicas" jsonschema:"Maximum desired replicas. Must be >= min_replicas when non-zero. Mutually exclusive with spread_all."` |
| 134 | + SpreadAll bool `json:"spread_all,omitempty" jsonschema:"When true, keep one replica on every matching node. Mutually exclusive with min_replicas/max_replicas."` |
| 135 | + RoutePolicy *string `json:"route_policy,omitempty" jsonschema:"Optional prefix-cache route policy override. Omit to preserve the existing value on updates."` |
| 136 | + BalanceAbsThreshold *int `json:"balance_abs_threshold,omitempty" jsonschema:"Optional absolute imbalance threshold override. Omit to preserve the existing value on updates."` |
| 137 | + BalanceRelThreshold *float64 `json:"balance_rel_threshold,omitempty" jsonschema:"Optional relative imbalance threshold override. Omit to preserve the existing value on updates."` |
| 138 | + MinPrefixMatch *float64 `json:"min_prefix_match,omitempty" jsonschema:"Optional minimum prefix match threshold override. Omit to preserve the existing value on updates."` |
| 139 | +} |
| 140 | + |
| 141 | +// DeleteSchedulingRequest identifies the model scheduling rule to remove. |
| 142 | +type DeleteSchedulingRequest struct { |
| 143 | + ModelName string `json:"model_name" jsonschema:"Installed model name whose scheduling config should be removed."` |
| 144 | +} |
| 145 | + |
118 | 146 | // ImportModelURIRequest is the input for import_model_uri. It mirrors the |
119 | 147 | // REST surface (`/models/import-uri`) closely so both clients can produce |
120 | 148 | // identical responses; the BackendPreference is a flat field rather than the |
|
0 commit comments