Repository navigation
feat(integrations): forward lang and min_confidence through the framework wrappers - #798
Merged
NandhaKishorM merged 1 commit intoOct 1, 2026
Conversation
…work wrappers The LangChain, CrewAI and LlamaIndex wrappers forwarded the token budgets and hook controls but dropped core's `lang` and `min_confidence`, so a node could not pin the routing/answering language or honor the abstention gate. Both are read by Agent.predict/system_one AND Router.predict, and both are laya-serve BODY_CONTROLS, so they are safe on the local and remote path alike (unlike the Router-only task/lang_guess keywords). Add them to the shared _controls module as DECISION_CONTROLS + decision_kwargs, wire them through every wrapper class, _execute_decision and _call_remote, omitting an unset value so it never shadows the checkpoint's default while a real falsy value (min_confidence=0.0, lang="") survives. Scope is the per-decision path; batch is left as-is because Router.predict_batch takes no per-request min_confidence. Tests: test_crewai 113, test_llamaindex 142, test_langchain 258 pass; ruff CI select and compileall clean; 5/5 mutation checks killed with named fails.
This was referenced Oct 1, 2026
Owner
|
Merged for 0.3.23. Verified on the integrated branch, not on the PR in isolation: every suite in the Thank you. |
This was referenced Oct 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Threads core's
langandmin_confidenceper-request controls through the LangChain, CrewAI and LlamaIndex wrappers, on both the localpredictpath and thelaya-serverequest body.laya/integrations/_controls.pygainsDECISION_CONTROLS = ("lang", "min_confidence")and adecision_kwargs(...)builder;predict_kwargs(...)now accepts and forwards both.LayaRouter,LayaGuardrail,LayaTriage,LayaEvaluator,LayaCrewRouter,LayaTaskGuard,LayaSingleSelector,LayaMultiSelector,LayaQueryRouter), its_execute_decisionand its_call_remotenow carry both.Why
The three wrappers already forwarded the two token budgets and the five hook arguments, but silently dropped
langandmin_confidence. So a graph node could not pin the language it routes and answers in (selecting the answering checkpoint's per-language calibration rather than built-in detection), nor honor core's abstention gate on a decision it is not confident about.Both controls are read by
Agent.predict/system_oneandRouter.predict, and both arelaya-serveBODY_CONTROLS, so -- unlike the Router-onlytask/lang_guesskeywords -- the same kwargs are safe on the local and the remote path. An unset value is omitted rather than sent asNoneso it cannot shadow the checkpoint's own default, while a real falsy value (min_confidence=0.0,lang="") is forwarded as given.Scope is the per-decision path. Batch is left unchanged because
Router.predict_batchtakes no per-requestmin_confidence.How it was verified
The guard suites enumerate every control out of
_controlsand read the forwarding back off a recording runner and a mocked urllib body, so a control added to the shared module without reaching a wrapper fails that wrapper's suite. A 5-mutant check (drop the executor's local forward on each of the three integrations, drop the remote**decision, drop themin_confidencebody write, and weakendecision_kwargs'is not Noneto truthiness) produced a named FAIL in each owning suite.Checklist
mainFixes #