Add source-constrained joint planning and scoped dependency-aware recovery

This commit is contained in:
Nico committed 2026-10-20 00:43:27 +02:00
1 parent d280f001fc
commit 83ef9e6d6c
23 files changed
+913 -42

No files matched your search

+6 -3
View File
@@ -25,7 +25,7 @@ class JointAdapter:
async def generate(self, config, request, *, max_response_bytes):
self.requests.append(copy.deepcopy(request))
if request["prompt_version"] == VERSION:
if request["prompt_version"] in {VERSION,"case_plan_v2"}:
interpretation = json.loads(json_bytes(payload()))
# Match the deterministic index created after canonical serialization.
sources = {}
@@ -35,6 +35,9 @@ class JointAdapter:
hp = proposals({"interpretation_sources": sources})
for p in hp["hypotheses"]:
p["interpretation_paths"] = [sources[k]["interpretation_pointer"] for k in p.pop("interpretation_ids")]
if request["prompt_version"]=="case_plan_v2":
for p in hp["hypotheses"]:
p["premises"]=[{"kind":"grounded","text":"Reported symptom", "source_ids":p["source_ids"],"interpretation_paths":p["interpretation_paths"]}]
result = {"interpretation":interpretation, "hypotheses":hp}
if self.change: self.change(result)
elif request["prompt_version"] == REPAIR:
@@ -48,7 +51,7 @@ class JointAdapter:
def interpret(store, gw):
return asyncio.run(CaseInterpreter(store,gw,joint_config=HypothesisConfig(),
return asyncio.run(CaseInterpreter(store,gw,joint_config=HypothesisConfig(),joint_version=1,
correction_config=CorrectionConfig()).interpret("case-A","stable-package"))
@@ -211,7 +214,7 @@ def test_joint_pipeline_reaches_output_and_reimports_without_another_model_call(
joint=JointAdapter();rest=PipelineAdapter()
class Adapter:
async def generate(self,config,request,**kw):
return await (joint if request["prompt_version"]==VERSION else rest).generate(config,request,**kw)
return await (joint if request["prompt_version"] in {VERSION,"case_plan_v2"} else rest).generate(config,request,**kw)
gw=gateway(Adapter())
result=asyncio.run(drive(store,gw,"case-A","stable-package",policies={"planning_mode":"joint"}))
assert result["status"]=="OUTPUT_READY"