Knowledge Base Signal
Overview
kb binds routing signals to the output of a named knowledge base instance.
Define these bindings under routing.signals.kb.
Use it for an embedding-backed knowledge base referenced by a reachable recipe. Only referenced KBs are prepared at startup; an unused catalog entry does not load its assets or start an embedding model.
Key Advantages
- Reuses one exemplar set across several routes.
- Keeps labels, groups, and numeric metrics explicit instead of relying on magic runtime names.
- Supports both winner-style and threshold-style signal bindings.
- Lets projections consume continuous knowledge base metrics without turning signals into a scripting surface.
What Problem Does It Solve?
Some routing policies depend on a curated exemplar set rather than a single keyword or embedding candidate list. One knowledge base can classify requests into privacy, safety, emotion, or preference labels, while the routing config exposes only the labels or groups that decisions need.
kb keeps that split explicit:
global.model_catalog.kbs[]owns the reusable knowledge base packagerouting.signals.kb[]binds specific labels or groups into named routing signalsrouting.projectionscan consume knowledge base metrics such asbest_score,best_matched_score, or configured group margins
When to Use
Use kb when:
- requests must be classified against a curated exemplar set
- one startup-loaded knowledge base result should feed several routes
- you want stable route-level groups without duplicating exemplars
- you need explicit bindings instead of implicit signal names
Configuration
global:
model_catalog:
kbs:
- name: privacy_kb
source:
path: knowledge_bases/privacy/
manifest: labels.json
threshold: 0.55
prototype_scoring:
enabled: true
cluster_similarity_threshold: 0.9
max_prototypes: 8
best_weight: 0.75
top_m: 2
margin_threshold: 0.05
label_thresholds:
prompt_injection: 0.7
groups:
privacy_policy: [proprietary_code, internal_document, pii]
security_containment: [prompt_injection, credential_exfiltration]
private: [proprietary_code, internal_document, pii, prompt_injection, credential_exfiltration]
public: [generic_coding, general_knowledge]
metrics:
- name: private_vs_public
type: group_margin
positive_group: private
negative_group: public
routing:
signals:
kb:
- name: privacy_policy
kb: privacy_kb
target:
kind: group
value: privacy_policy
match: best
- name: proprietary_code
kb: privacy_kb
target:
kind: label
value: proprietary_code
match: threshold
Keep knowledge base names stable because kb signals bind to those names directly.
When prototype_scoring is enabled, the KB builds per-label prototype banks from the label exemplars. Runtime classification then scores labels from those label-owned prototypes instead of letting one raw exemplar dominate the whole label forever.