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

Function NewHTTPJSONKB

internal/retrieval/http_kb.go:29–41  ·  view source on GitHub ↗

NewHTTPJSONKB builds an adapter for knowledge_bases type "http".

(kb config.KnowledgeBaseConfig)

Source from the content-addressed store, hash-verified

27
28// NewHTTPJSONKB builds an adapter for knowledge_bases type "http".
29func NewHTTPJSONKB(kb config.KnowledgeBaseConfig) (*HTTPJSONKB, error) {
30 if strings.TrimSpace(kb.Endpoint) == "" {
31 return nil, fmt.Errorf("http kb %q: empty endpoint", kb.Name)
32 }
33 ms := httpClientTimeoutMS(kb)
34 return &HTTPJSONKB{
35 name: kb.Name,
36 cfg: kb,
37 client: &http.Client{
38 Timeout: time.Duration(ms) * time.Millisecond,
39 },
40 }, nil
41}
42
43func (h *HTTPJSONKB) Name() string { return h.name }
44

Callers 2

TestHTTPJSONKB_RetrieveFunction · 0.85
FromConfigFunction · 0.85

Calls 1

httpClientTimeoutMSFunction · 0.85

Tested by 1

TestHTTPJSONKB_RetrieveFunction · 0.68