Skip to content

armgit / laya

Public Imported from GitHub
0

Non-autoregressive System 1 decision engine. Typed choice, score and yes/no decisions over any text in a single forward pass, in 100+ languages, with a router that picks the right checkpoint per request.

fix(router): report `repo` as a string for an auto-detected workflow (#205)

Paulo Carinhenaed9f65bbf63f
diff --git a/laya/router.py b/laya/router.py
index 83659a0d..2e98255e 100644
--- a/laya/router.py
+++ b/laya/router.py
@@ -338,7 +338,7 @@ class Router:
workflow = match_typed_decisions_workflow(questions or {})
if workflow and self.auto_task_detection:
- return RouteDecision(model="typed-decisions", repo=self.models["typed-decisions"],
+ return RouteDecision(model="typed-decisions", repo=_repo_str(self.models["typed-decisions"]),
reason="question ids match the %r typed-decisions workflow" % workflow,
detection=None, workflow=workflow)
diff --git a/tests/test_router.py b/tests/test_router.py
index 114c49e0..2ac23df7 100644
--- a/tests/test_router.py
+++ b/tests/test_router.py
@@ -224,6 +224,16 @@ check("route/auto ON but generic questions",
# explicit model still beats auto-detected workflow
check("route/explicit beats workflow",
r_auto.route({"body": "x"}, Q_TD, model="multilingual")["model"], "multilingual")
+# An auto-detected workflow reports `repo` like every other branch does. It used to hand back the raw
+# (repo, subfolder) spec, which serialises to a JSON list instead of the "repo/subfolder" string.
+check("route/auto workflow repo is a string",
+ r_auto.route({"body": "I was charged twice"}, Q_TD)["repo"], "convaiinnovations/laya/typed-decisions")
+check("route/auto workflow repo matches explicit task",
+ r_auto.route({"body": "I was charged twice"}, Q_TD)["repo"],
+ r_auto.route({"body": "I was charged twice"}, Q_TD, task="typed_decisions")["repo"])
+check("route/auto workflow repo standalone",
+ Router(auto_task_detection=True, standalone_repos=True).route({"body": "x"}, Q_TD)["repo"],
+ "convaiinnovations/laya-typed-decisions")
# decision payload shape
d = r.route({"body": "मुझसे दो बार शुल्क लिया गया"}, Q_GENERIC)