Skip to main content

config.json — Router Configuration

The config/config.json file controls the global behavior of the routing engine and the server.

Online Web Configurator

To make creating your configuration files easier, you can use the l3mcore Online Configurator to visually and intuitively generate your experts.json file.

Complete Structure

{
"router": {
"mode": "generic",
"router_type": "embedding",
"model_path": "intfloat/multilingual-e5-small",
"categories_file": "config/experts.json",
"confidence_threshold": 0.4,
"keyword_fallback": true,
"softmax_temperature": 0.15,
"scoring_weights": {
"max_keyword": 0.40,
"description": 0.30,
"mean_keyword": 0.20,
"top3_vote": 0.10
}
}
}

Parameter Reference

ParameterTypeDefaultDescription
modestring"generic""generic" uses experts.json. "model" uses a custom classifier.
router_typestring"embedding""embedding" for vector semantic search (recommended). "classification" for fine-tuned BERT model.
model_pathstring"intfloat/multilingual-e5-small"HuggingFace repo or local path. Empty "" to disable ML and use only keywords.
categories_filestring"config/experts.json"Path to the experts file. Must be inside the project (security).
confidence_thresholdfloat0.4Minimum probability to select an expert. If no one reaches it, fallbacks are used.
keyword_fallbackbooltrueActivates fuzzy matching if ML fails or falls below the threshold.
softmax_temperaturefloat0.15Controls the "decisiveness" of the router. Lower = more decisive. Higher = smoother.
scoring_weightsobjectsee belowWeights of the hybrid scoring formula.
context_messagesint3Number of recent user messages to concatenate for cascade routing when the last message has low confidence.
context_max_charsint1600Maximum characters for the concatenated context text, to respect the token window of the embedding model.

Weight Tuning (scoring_weights)

The four weights must add up to 1.0:

WeightDefaultWhat it controls
max_keyword0.40Maximum similarity with any single keyword. Detects precise terms.
description0.30Similarity with the expert's description. Captures the general intent.
mean_keyword0.20Mean similarity with all keywords. Measures general domain coverage.
top3_vote0.10Fraction of the top 3 keywords above 0.4 threshold. Requires consensus.

Tuning Examples

Prioritize exact matches of technical terms:

"scoring_weights": {
"max_keyword": 0.55,
"description": 0.20,
"mean_keyword": 0.20,
"top3_vote": 0.05
}

Prioritize general semantic understanding:

"scoring_weights": {
"max_keyword": 0.25,
"description": 0.50,
"mean_keyword": 0.20,
"top3_vote": 0.05
}

Softmax Temperature

The temperature controls how "confident" the router is when making a choice:

  • 0.05 – 0.15 → Very decisive router, a single option dominates
  • 0.20 – 0.35 → Balanced (recommended)
  • 0.50+ → Differences between experts are smoothed out, may cause inaccurate routing
warning

Lowering the temperature too much (< 0.05) can make the router rigid and make bad choices in edge cases. Raise the confidence_threshold instead if you want more strictness.