Explain missing capture citations in entity assessment corrections
This commit is contained in:
1 parent
79a6934b9e
commit
6c3415b13a
4 files changed
+74
-2
No files matched your search
@@ -332,3 +332,38 @@ def test_legacy_resolution_requests_and_completed_packages_remain_replayable(bui
|
||||
assert result.status=='COMPLETED'
|
||||
assert model.requests[0]['prompt_version']==f'entity_resolution_plan_v{legacy_version}'
|
||||
assert run(store,model).reused and len(model.requests)==3
|
||||
|
||||
|
||||
def test_missing_capture_feedback_resumes_and_replays_without_repeating_research(built_case):
|
||||
class MissingCaptureModel(Model):
|
||||
async def generate(self, config, request, *, max_response_bytes):
|
||||
response = await super().generate(config, request, max_response_bytes=max_response_bytes)
|
||||
if request['prompt_version'] == 'entity_resolution_assessment_v3':
|
||||
data = json.loads(request['messages'][1]['content'])
|
||||
if 'validation_feedback' not in data:
|
||||
for resolution in response.document['resolutions']:
|
||||
resolution['source_ids'] = ['O0001']
|
||||
resolution['reason'] = 'The right capture is V0001 but only mentioned here.'
|
||||
else:
|
||||
fixes = data['validation_feedback']['citation_corrections']
|
||||
assert fixes['missing_capture_sources'] == [{
|
||||
'search_index':0, 'required_source_id':'V0001',
|
||||
'field':'/resolutions/0/source_ids', 'original_mention_source_ids':['O0001']}]
|
||||
return response
|
||||
store = built_case[0]
|
||||
model = MissingCaptureModel()
|
||||
service = service_for(store)
|
||||
rejected = run(store, model, service)
|
||||
assert rejected.status == 'REJECTED'
|
||||
assert rejected.code == 'ENTITY_RESOLUTION_CAPTURE_SOURCE'
|
||||
assert len(service.database.calls) == 1
|
||||
result = run(store, model, service)
|
||||
assert result.status == 'COMPLETED'
|
||||
assert len(service.database.calls) == 1
|
||||
assert len(model.requests) == 4
|
||||
with PackageReader(result.package) as reader:
|
||||
feedback_ref = 'analysis/interpretations/0001/entity-resolution/feedback-assessment-0002.json'
|
||||
assert feedback_ref in reader.files
|
||||
assert PackageValidator().validate(result.package).valid
|
||||
assert run(store, model).reused
|
||||
assert len(model.requests) == 4
|
||||
Reference in new issue
Block a user