(info map[string]interface{}, key string)
| 198 | } |
| 199 | |
| 200 | func 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 | |
| 216 | func FetchOllamaModelInfo(apiURL, modelName string) (*OllamaModelInfo, error) { |
| 217 | url := fmt.Sprintf("%s/api/show", apiURL) |
no outgoing calls
no test coverage detected