Spaces:
Runtime error
Runtime error
File size: 883 Bytes
857a91b | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | // Package models provides model-serving runtime detection and the model
// inspection logic used by the model.inspect job.
package models
import "os/exec"
// Runtimes reports which model-serving runtimes are available on the host.
type Runtimes struct {
Node bool `json:"node"`
Python bool `json:"python"`
Ollama bool `json:"ollama"`
VLLM bool `json:"vllm"`
SGLang bool `json:"sglang"`
}
// DetectRuntimes probes the host PATH for known runtimes.
func DetectRuntimes() Runtimes {
return Runtimes{
Node: hasBinary("node"),
Python: hasBinary("python3") || hasBinary("python"),
Ollama: hasBinary("ollama"),
VLLM: hasBinary("vllm"),
SGLang: hasBinary("sglang") || hasBinary("python") && false, // sglang is a python module; treated as unavailable unless CLI present
}
}
func hasBinary(name string) bool {
_, err := exec.LookPath(name)
return err == nil
}
|