Function
effectiveTopK
(kb config.KnowledgeBaseConfig, opts map[string]any, fallback int)
Source from the content-addressed store, hash-verified
| 3 | import "github.com/infercore/infercore/internal/config" |
| 4 | |
| 5 | func effectiveTopK(kb config.KnowledgeBaseConfig, opts map[string]any, fallback int) int { |
| 6 | if opts != nil { |
| 7 | switch v := opts["top_k"].(type) { |
| 8 | case int: |
| 9 | if v > 0 { |
| 10 | return v |
| 11 | } |
| 12 | case int64: |
| 13 | if v > 0 { |
| 14 | return int(v) |
| 15 | } |
| 16 | case float64: |
| 17 | if v > 0 { |
| 18 | return int(v) |
| 19 | } |
| 20 | } |
| 21 | } |
| 22 | if kb.TopK > 0 { |
| 23 | return kb.TopK |
| 24 | } |
| 25 | return fallback |
| 26 | } |
| 27 | |
| 28 | func httpClientTimeoutMS(kb config.KnowledgeBaseConfig) int { |
| 29 | if kb.HTTPTimeoutMS > 0 { |
Tested by
no test coverage detected