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.

Merge pull request #522 from aashish254/feat-langchain-batch

Nandakishor685bd2f04786
diff --cc laya/integrations/langchain.py
index 3674e043,0471c44b..43de4bd3
--- a/laya/integrations/langchain.py
+++ b/laya/integrations/langchain.py
@@@ -231,20 -353,12 +353,14 @@@ class LayaRouter(_BatchedRunnable, Runn
"criteria": self.criteria,
}
}
- res = _execute_decision(
- text,
- questions,
- agent=self.agent,
- base_url=self.base_url,
- api_key=self.api_key,
- model=self.model,
- )
- self.last_decision = res
- ans = res["answers"][self.question_id]
+
+ def _finish(self, result: Dict[str, Any], input: Any) -> str:
+ self.last_decision = result
+ ans = result["answers"][self.question_id]
choice = ans["choice"]
- confidence = ans.get("confidence", 1.0)
+ confidence = ans.get("answer_confidence")
+ if confidence is None:
+ confidence = ans.get("confidence", 1.0)
if self.confidence_threshold > 0.0 and confidence < self.confidence_threshold:
if self.fallback is not None: