update
This commit is contained in:
@@ -17,6 +17,7 @@ from app.modules.work_assistant import personnel_context as context
|
||||
|
||||
RULE_VERSION = "personnel-profile-v6"
|
||||
REVIEW_SECONDS = 150
|
||||
VERIFICATION_BATCH_SIZE = 8
|
||||
MAX_CORRECTIONS = 5
|
||||
MAX_PROFILE_REPAIRS = 18
|
||||
FULL_RESULT_TOKENS = 9000
|
||||
@@ -1176,7 +1177,12 @@ def review_profile(entry: ProfileRequest, *, invoke=complete_json, checkpoint=No
|
||||
workflow_steps=int(resume.get('workflow_steps',0))
|
||||
workflow_phase=resume.get('workflow_phase','generating')
|
||||
calls_in_slice=0
|
||||
verification_batch_size=max(1,min(8,int(resume.get('verification_batch_size',4 if staged else 8))))
|
||||
# Old staged jobs started with four rows. Keep a known reduction, and let
|
||||
# jobs still using the old default adopt the larger batch on their next slice.
|
||||
previous_batch = int(resume.get('verification_batch_size', VERIFICATION_BATCH_SIZE))
|
||||
if staged and 'verification_batch_ceiling' not in resume and previous_batch == 4:
|
||||
previous_batch = VERIFICATION_BATCH_SIZE
|
||||
verification_batch_size = max(1, min(VERIFICATION_BATCH_SIZE, previous_batch))
|
||||
last_checkpoint={}
|
||||
def remember(candidate,attempt,feedback=None):
|
||||
nonlocal last_checkpoint
|
||||
@@ -1186,7 +1192,7 @@ def review_profile(entry: ProfileRequest, *, invoke=complete_json, checkpoint=No
|
||||
'split_generation':split_generation,'generation_parts':deepcopy(generation_parts),
|
||||
'grounding_cache':deepcopy(grounding_cache),'grounding_revision':GROUNDING_REVISION,'repair_revision':REPAIR_REVISION}
|
||||
saved.update(workflow_steps=workflow_steps,workflow_phase=workflow_phase,operation_truncations=dict(operation_truncations))
|
||||
saved['verification_batch_size']=verification_batch_size
|
||||
saved.update(verification_batch_size=verification_batch_size, verification_batch_ceiling=VERIFICATION_BATCH_SIZE)
|
||||
if staged:
|
||||
saved.update(context_revision=context.CONTEXT_REVISION,context_scans=deepcopy(scans),context_limits=dict(context_limits))
|
||||
saved['verified_current']=0
|
||||
@@ -1207,6 +1213,7 @@ def review_profile(entry: ProfileRequest, *, invoke=complete_json, checkpoint=No
|
||||
request_schema=future_role_contract(request_schema,data['duty_refs'],data['behavior_refs']+data['readable_refs'])
|
||||
stage=('scan' if 'evidence_batch' in payload else 'verify' if 'issues' in request_schema.get('properties',{})
|
||||
else 'repair' if 'repair_keys' in payload or 'validation_feedback' in payload else 'generate')
|
||||
verification_rows=sum(map(len,payload['candidate'].values())) if stage=='verify' and not payload.get('adjudication') else 0
|
||||
operation=('adjudicate' if payload.get('adjudication') else stage+':'+(payload.get('evidence_batch') or payload.get('generation_part')
|
||||
or ','.join(payload.get('repair_keys',[])+payload.get('repair_sections',[]))))
|
||||
transform=kwargs.pop('transform',lambda value:value)
|
||||
@@ -1220,8 +1227,8 @@ def review_profile(entry: ProfileRequest, *, invoke=complete_json, checkpoint=No
|
||||
if count(payload)>limit:
|
||||
# Verification is already local to cited rows. Split the pending
|
||||
# assertions before narrowing a single row's reference context.
|
||||
if stage=='verify' and not payload.get('adjudication') and verification_batch_size>1:
|
||||
verification_batch_size=max(1,verification_batch_size//2)
|
||||
if verification_rows>1:
|
||||
verification_batch_size=verification_rows//2
|
||||
remember(last_checkpoint.get('candidate',raw),last_checkpoint.get('corrections',corrections))
|
||||
raise JobDeferred()
|
||||
nested='material' in payload and 'evidence_columns' in payload['material']
|
||||
@@ -1293,10 +1300,10 @@ def review_profile(entry: ProfileRequest, *, invoke=complete_json, checkpoint=No
|
||||
# These pages are already below the bounded input limit. A
|
||||
# different upstream capacity must not reopen the same page forever.
|
||||
raise ModelUnavailable('profile_context_limit') from exc
|
||||
if staged and stage=='verify' and not payload.get('adjudication') and verification_batch_size>1 and exc.reason in {'direct_output_truncated','gateway_output_truncated','direct_timeout','model_context_full','context_capacity'}:
|
||||
if staged and verification_rows>1 and exc.reason in {'direct_output_truncated','gateway_output_truncated','direct_timeout','model_context_full','context_capacity'}:
|
||||
# A long verification response is a unit-size problem. Keep all
|
||||
# accepted rows and automatically retry a smaller pending batch.
|
||||
verification_batch_size=max(1,verification_batch_size//2)
|
||||
verification_batch_size=verification_rows//2
|
||||
remember(last_checkpoint.get('candidate',raw),last_checkpoint.get('corrections',corrections),last_checkpoint.get('validation_feedback'))
|
||||
raise JobDeferred() from exc
|
||||
if staged and stage!='scan' and exc.reason in {'model_context_full','context_capacity'}:
|
||||
|
||||
Reference in New Issue
Block a user