system HF Staff commited on
Commit
42801ac
·
verified ·
1 Parent(s): 7bb6bff

Publish AgentWeave Router MiniLM from 4f2a12b

Browse files
Files changed (1) hide show
  1. router.py +7 -3
router.py CHANGED
@@ -13,11 +13,12 @@ ROOT = Path(__file__).resolve().parent
13
 
14
 
15
  class AgentWeaveSemanticRouter:
16
- """Prototype-based semantic capability router built on MiniLM embeddings.
17
 
18
  This is an experimental semantic companion to AgentWeave's default
19
  deterministic routing path. It does not replace AgentWeave policy,
20
- authorization, or execution controls.
 
21
  """
22
 
23
  def __init__(
@@ -29,7 +30,10 @@ class AgentWeaveSemanticRouter:
29
  self.prototypes: Dict[str, List[str]] = json.loads(
30
  Path(prototypes_path).read_text(encoding="utf-8")
31
  )
32
- self.model = SentenceTransformer(self.config["base_model"], device="cpu")
 
 
 
33
 
34
  texts: List[str] = []
35
  labels: List[str] = []
 
13
 
14
 
15
  class AgentWeaveSemanticRouter:
16
+ """Prototype-based semantic capability router built on frozen MiniLM embeddings.
17
 
18
  This is an experimental semantic companion to AgentWeave's default
19
  deterministic routing path. It does not replace AgentWeave policy,
20
+ authorization, or execution controls. The upstream encoder is loaded as a
21
+ runtime dependency; this repository is not a fine-tuned MiniLM model.
22
  """
23
 
24
  def __init__(
 
30
  self.prototypes: Dict[str, List[str]] = json.loads(
31
  Path(prototypes_path).read_text(encoding="utf-8")
32
  )
33
+ encoder_model = self.config.get("encoder_model") or self.config.get("base_model")
34
+ if not encoder_model:
35
+ raise ValueError("config.json must define 'encoder_model'")
36
+ self.model = SentenceTransformer(str(encoder_model), device="cpu")
37
 
38
  texts: List[str] = []
39
  labels: List[str] = []