Documentation
¶
Index ¶
- Constants
- func CheckHardware(parameterSize string, systemRAMGB float64) (bool, float64)
- func Detect(ctx context.Context, baseURL string) bool
- func EstimateRAMGB(paramsB float64) float64
- func FetchSWEBenchScores(ctx context.Context, url string) (map[string]float64, error)
- func FindSWEScore(scores map[string]float64, hfRepoID string) (float64, bool)
- func FormatActiveTOMLSnippet(ranked []RankedModel) string
- func FormatTOMLSnippet(ranked []RankedModel) string
- func GetSystemRAMGB() float64
- func InferTaskLabel(info HFModelInfo, ollamaName string) string
- func MatchModelScore(ollamaName string, scores map[string]float64) (float64, bool)
- func ModelFamily(name string) string
- func ParseParamSize(s string) float64
- type HFModelInfo
- type Model
- type RankedModel
Constants ¶
const DefaultBaseURL = "http://localhost:11434"
DefaultBaseURL is the default ollama API endpoint.
const HuggingFaceAPIURL = "https://huggingface.co/api/models"
HuggingFaceAPIURL is the default HuggingFace Hub API base URL.
const SWEBenchURL = "https://raw.githubusercontent.com/SWE-bench/swe-bench.github.io/master/data/leaderboards.json"
SWEBenchURL is the default URL for SWE-bench leaderboard data.
Variables ¶
This section is empty.
Functions ¶
func CheckHardware ¶
CheckHardware checks if a model with given parameter size fits in available RAM. Returns (ok, neededGB). If parameter size is unknown, returns (true, 0).
func EstimateRAMGB ¶
EstimateRAMGB estimates RAM needed (GB) for a Q4_K_M quantized model. Formula: params_in_billions * 0.55 + 2 GB overhead. Returns 0 if paramsB is 0.
func FetchSWEBenchScores ¶
FetchSWEBenchScores fetches the SWE-bench Verified leaderboard and returns the best score per model. Keys include lowercased model tags, HuggingFace repo paths extracted from URL tags, and model name parts.
All entries are included (not filtered by os_model) so that HF repo ID matching can find scores for any model.
func FindSWEScore ¶
FindSWEScore finds the best SWE-bench score for a HuggingFace repo ID. It checks the scores map using the full repo ID, the model name part, and case-insensitive variants.
func FormatActiveTOMLSnippet ¶ added in v0.3.0
func FormatActiveTOMLSnippet(ranked []RankedModel) string
FormatActiveTOMLSnippet generates an active (uncommented) TOML snippet for devcell.toml from ranked models. The #1 ranked model becomes the default.
func FormatTOMLSnippet ¶
func FormatTOMLSnippet(ranked []RankedModel) string
FormatTOMLSnippet generates a commented-out TOML snippet for devcell.toml from ranked models.
func GetSystemRAMGB ¶
func GetSystemRAMGB() float64
GetSystemRAMGB returns total system RAM in GB (Linux).
func InferTaskLabel ¶
func InferTaskLabel(info HFModelInfo, ollamaName string) string
InferTaskLabel returns a short human-readable label for what a model is good at, based on HuggingFace tags and model name.
func MatchModelScore ¶
MatchModelScore finds the SWE-bench score for an ollama model name. It strips the :size suffix and does case-insensitive matching.
func ModelFamily ¶
ModelFamily strips the :tag suffix from an ollama model name (exported). "deepseek-r1:32b" → "deepseek-r1", "codellama:latest" → "codellama".
func ParseParamSize ¶
ParseParamSize parses a parameter size string like "32B" or "671M" into billions of parameters. Returns 0 if unparseable.
Types ¶
type HFModelInfo ¶
type HFModelInfo struct {
ModelID string `json:"modelId"`
PipelineTag string `json:"pipeline_tag"`
Tags []string `json:"tags"`
}
HFModelInfo holds model metadata from HuggingFace.
func FetchHFModelInfo ¶
FetchHFModelInfo searches the HuggingFace Hub API for a model by name and returns its metadata. The baseURL parameter allows test injection.
type RankedModel ¶
type RankedModel struct {
Model
SWEScore float64
Rank int
ScoreSource string // "SWE", "est", or "" (no score)
}
RankedModel is a Model with its SWE-bench score and rank position.
func RankModels ¶
func RankModels(models []Model, limit int, sweScores map[string]float64, hfInfoMap map[string]HFModelInfo) []RankedModel
RankModels sorts models by SWE-bench score (descending) and limits to top N. It tries multiple matching strategies in order:
- Direct family match against sweScores (MatchModelScore)
- HF repo ID match against sweScores (FindSWEScore via hfInfoMap)
- Hardcoded fallback ratings
ScoreSource is set to "SWE" for live matches, "est" for fallback, "" for no score.