MCPcopy Create free account
hub / github.com/InferCore/InferCore / effectiveTopK

Function effectiveTopK

internal/retrieval/common.go:5–26  ·  view source on GitHub ↗
(kb config.KnowledgeBaseConfig, opts map[string]any, fallback int)

Source from the content-addressed store, hash-verified

3import "github.com/infercore/infercore/internal/config"
4
5func 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
28func httpClientTimeoutMS(kb config.KnowledgeBaseConfig) int {
29 if kb.HTTPTimeoutMS > 0 {

Callers 3

RetrieveMethod · 0.85
RetrieveMethod · 0.85
RetrieveMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected