Add placeholders for court decision text and comment in legal position prompt
Browse files- main.py +8 -0
- prompts.py +8 -0
main.py
CHANGED
|
@@ -579,6 +579,14 @@ def generate_legal_position(
|
|
| 579 |
print(f"[DEBUG] FINAL court_decision_text preview: {court_decision_text[:300]}")
|
| 580 |
print(f"[DEBUG] comment_input: {comment_input[:100] if comment_input else 'Empty'}")
|
| 581 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 582 |
content = lp_prompt.format(
|
| 583 |
court_decision_text=court_decision_text,
|
| 584 |
comment=comment_input if comment_input else "Коментар відсутній"
|
|
|
|
| 579 |
print(f"[DEBUG] FINAL court_decision_text preview: {court_decision_text[:300]}")
|
| 580 |
print(f"[DEBUG] comment_input: {comment_input[:100] if comment_input else 'Empty'}")
|
| 581 |
|
| 582 |
+
# Check if placeholders exist in the prompt, if not - append them to the end
|
| 583 |
+
if "{court_decision_text}" not in lp_prompt:
|
| 584 |
+
print("[WARNING] {court_decision_text} placeholder missing in prompt! Appending to the end.")
|
| 585 |
+
lp_prompt += "\n\n<court_decision>\n{court_decision_text}\n</court_decision>"
|
| 586 |
+
|
| 587 |
+
if "{comment}" not in lp_prompt:
|
| 588 |
+
lp_prompt += "\n\n<comment>\n{comment}\n</comment>"
|
| 589 |
+
|
| 590 |
content = lp_prompt.format(
|
| 591 |
court_decision_text=court_decision_text,
|
| 592 |
comment=comment_input if comment_input else "Коментар відсутній"
|
prompts.py
CHANGED
|
@@ -17,6 +17,14 @@ LEGAL_POSITION_PROMPT = """<task>
|
|
| 17 |
4. **Категорію** — конкретна правова категорія з посиланням на статті закону
|
| 18 |
</task>
|
| 19 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20 |
<rules>
|
| 21 |
<rule id="abstraction">
|
| 22 |
Формулюй правову позицію як АБСТРАКТНЕ ПРАВИЛО, придатне для застосування
|
|
|
|
| 17 |
4. **Категорію** — конкретна правова категорія з посиланням на статті закону
|
| 18 |
</task>
|
| 19 |
|
| 20 |
+
<court_decision>
|
| 21 |
+
{court_decision_text}
|
| 22 |
+
</court_decision>
|
| 23 |
+
|
| 24 |
+
<comment>
|
| 25 |
+
{comment}
|
| 26 |
+
</comment>
|
| 27 |
+
|
| 28 |
<rules>
|
| 29 |
<rule id="abstraction">
|
| 30 |
Формулюй правову позицію як АБСТРАКТНЕ ПРАВИЛО, придатне для застосування
|