Reducing chance to minimum for AI response to fail

This commit is contained in:
2025-02-18 16:21:00 +01:00
parent 44b5664297
commit 51a6701794

View File

@@ -131,13 +131,11 @@ def get_controls_for_risk(risk, organization):
if control_id in valid_control_ids and 1 <= weight <= 10:
if control_id in control_ids_seen:
valid = False
break
continue
selected_controls.append((control_id, weight))
control_ids_seen.add(control_id)
else:
valid = False
break
continue
if valid and len(selected_controls) == 10:
return selected_controls
@@ -145,7 +143,6 @@ def get_controls_for_risk(risk, organization):
print(f"Recived {len(selected_controls)} controls. Retrying for missing ones...\n")
remaining_controls = valid_control_ids - control_ids_seen
missing_count = 10 - len(selected_controls)
if missing_count > 0:
remaining_controls_list = [f"Control ID:{cid}, Control Name: {control_map[cid]}" for cid in remaining_controls]
prompt = f"""