Add dbn-legal-agent targeted check step to BVJ Analyzer (Step 6b)
Probe testing revealed the fine-tune loops when asked to check a brief directly (tool-planning architecture conflict) but answers focused legal Q&A reliably in ~55s. New step 6b asks one targeted question per document type (akuttvedtak → § 4-25 klar nødvendighet, adopsjon → Strand Lobben, undersøkelse → fvl § 17/§ 41) and merges the finding into procedural_red_flags with check_model provenance. Silent on timeout/error. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -953,6 +953,25 @@ PROMPT;
|
||||
];
|
||||
}
|
||||
|
||||
// Step 6b: dbn-legal-agent targeted legal Q&A check (azure engines only; silent on failure)
|
||||
// Asks one focused question about the document's statutory basis to surface domain knowledge
|
||||
// that Azure reliably misses (klar nødvendighet threshold, Strand Lobben, fvl §17/§41).
|
||||
if (in_array($engine, ['azure_mini', 'azure_full'], true)) {
|
||||
$checkFindings = dbnToolsRunLegalCheck(
|
||||
(string)($json['advocacy_brief'] ?? ''),
|
||||
$docType
|
||||
);
|
||||
if (!empty($checkFindings)) {
|
||||
if (!is_array($json['procedural_red_flags'] ?? null)) {
|
||||
$json['procedural_red_flags'] = [];
|
||||
}
|
||||
foreach ($checkFindings as $cf) {
|
||||
$json['procedural_red_flags'][] = $cf;
|
||||
}
|
||||
$json['check_model'] = 'dbn-legal-agent';
|
||||
}
|
||||
}
|
||||
|
||||
return ['json' => $json, 'deploy_label' => $deployLabel];
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user