MCPcopy
hub / github.com/sammcj/gollama / extractModelInfo

Function extractModelInfo

vramestimator/vramestimator.go:200–214  ·  view source on GitHub ↗
(info map[string]interface{}, key string)

Source from the content-addressed store, hash-verified

198}
199
200func extractModelInfo(info map[string]interface{}, key string) (float64, bool) {
201 for k, v := range info {
202 if strings.HasSuffix(k, key) {
203 switch val := v.(type) {
204 case float64:
205 return val, true
206 case int64:
207 return float64(val), true
208 case int:
209 return float64(val), true
210 }
211 }
212 }
213 return 0, false
214}
215
216func FetchOllamaModelInfo(apiURL, modelName string) (*OllamaModelInfo, error) {
217 url := fmt.Sprintf("%s/api/show", apiURL)

Callers 2

CalculateVRAMFunction · 0.85
CalculateContextFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected