Group resolved entities and distinguish locally described behavior

This commit is contained in:
Nico committed 2026-10-15 01:33:35 +02:00
1 parent 12bc84c02c
commit cb57db794d
15 files changed
+997 -146

No files matched your search

@@ -93,6 +93,15 @@ def test_real_contextual_identity_resolution_with_fixture_llm(service, tmp_path)
assert any(e['id']=='23486' for e in entities.values())
resolved=next(k for k,e in entities.items() if e['id']=='23487')
doc=missing_payload()
if request["prompt_version"]=="case_interpretation_resolved_v3":
doc.update(described_behavior=[{'text':'The quest describes catching wild creatures using a net while intoxicated or wearing goggles.',
'source_ids':[self.mention],'basis':'local_description','verification':'not_independently_verified'}],
provisional_behavior_gap={'text':'The tester does not see these creatures despite wearing goggles.',
'source_ids':['O0002',self.mention],'basis':'local_description','status':'provisional'})
doc['observed_behavior']=[{'text':'Tester reports that Wolpertingers are not seen at the quest location.',
'source_ids':['O0001','O0002']}]
doc['interpretation_summary']={'text':'The described capture flow differs from the observation; formal verification is still missing.',
'source_ids':['O0002',self.mention,'Q0001']}
doc['relevant_entities']=[{'entity_id':resolved,'reason':'Wild creature required by the quest, distinct from Goldark.',
'source_ids':[resolved,self.mention]}]
return ProviderResponse(doc,'fixture-model',100,20)
@@ -100,6 +109,12 @@ def test_real_contextual_identity_resolution_with_fixture_llm(service, tmp_path)
model=Model()
result=asyncio.run(CaseInterpreter(store,gateway(model),project_research=service).interpret(*identity))
assert result.status=='COMPLETED' and PackageValidator().validate(result.package).valid
with PackageReader(result.package) as reader:
document=json.loads(reader.read_bytes(result.interpretation_ref))
assert document['interpretation']['described_behavior'][0]['verification']=='not_independently_verified'
assert document['interpretation']['provisional_behavior_gap']['status']=='provisional'
assert document['expected_behavior_completeness']=='missing'
assert 'Locally described behavior' in reader.read_bytes(result.summary_ref).decode()
assert len(model.calls)==3
assert asyncio.run(CaseInterpreter(store,gateway(model)).interpret(*identity)).reused
assert len(model.calls)==3