feat(tools): add letter length + summary depth controls; harden korrespond §-discipline
- Summarize: new depth param (brief/standard/detailed) with depth-aware prompt instructions and coverage mandate; wired through API + JS - Korrespond: new letter length param (concise/standard/detailed) injected as Lengde: instruction in draft pass; wired through API + JS - Korrespond draft prompt: add §-discipline rule (cite only directly relevant §§) plus Opphevet guard (aligned with dobetterlegal-tools) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
+23
-4
@@ -1854,7 +1854,8 @@ PROMPT;
|
||||
string $text,
|
||||
string $language = 'en',
|
||||
string $engine = 'azure_mini',
|
||||
string $corpusContext = ''
|
||||
string $corpusContext = '',
|
||||
string $depth = 'standard'
|
||||
): array {
|
||||
$text = $this->requirePasteText($text);
|
||||
$engine = in_array($engine, ['azure_mini', 'azure_full', 'gpu'], true) ? $engine : 'azure_mini';
|
||||
@@ -1870,16 +1871,34 @@ PROMPT;
|
||||
. $text;
|
||||
}
|
||||
|
||||
$depthInstructions = match($depth) {
|
||||
'brief' => [
|
||||
'what_we_found' => '1-2 sentence executive summary covering the main outcome',
|
||||
'key_facts' => 'up to 3 most important facts',
|
||||
'coverage' => '',
|
||||
],
|
||||
'detailed' => [
|
||||
'what_we_found' => 'comprehensive 6-10 sentence summary covering every fact, decision, party, date, and legal implication',
|
||||
'key_facts' => 'every fact, decision, and legal reference mentioned in the document',
|
||||
'coverage' => "\nCover ALL parties, ALL key decisions, ALL dates, and ALL legal references present in the document. Do not omit facts because they seem minor — err on the side of inclusion.",
|
||||
],
|
||||
default => [
|
||||
'what_we_found' => '3-5 sentence summary covering all key outcomes, parties, and decisions',
|
||||
'key_facts' => 'all key facts',
|
||||
'coverage' => "\nCover ALL parties, ALL key decisions, ALL dates, and ALL legal references present in the document.",
|
||||
],
|
||||
};
|
||||
|
||||
$prompt = <<<PROMPT
|
||||
Summarise the following document in {$locale}. Do not invent facts not present in the text.
|
||||
Return JSON only — no extra text before or after the JSON object.
|
||||
Return JSON only — no extra text before or after the JSON object.{$depthInstructions['coverage']}
|
||||
|
||||
{$enriched}
|
||||
|
||||
Return this JSON structure:
|
||||
{
|
||||
"what_we_found": "plain-language summary (2-4 sentences)",
|
||||
"key_facts": ["fact 1", "fact 2"],
|
||||
"what_we_found": "{$depthInstructions['what_we_found']}",
|
||||
"key_facts": ["{$depthInstructions['key_facts']}"],
|
||||
"dates": ["date or event phrase"],
|
||||
"parties": ["party or role"],
|
||||
"legal_references_detected": ["statute, article, or case name"],
|
||||
|
||||
Reference in New Issue
Block a user