Spaces:
Running
Running
dboa9 commited on
Commit ·
9a86887
1
Parent(s): b16b38e
updates
Browse files
app.py
CHANGED
|
@@ -303,11 +303,13 @@ def security_info():
|
|
| 303 |
|
| 304 |
|
| 305 |
# Legal document exhibit reference instruction — injected into every generate/chat so edit sources always get it
|
| 306 |
-
|
|
|
|
|
|
|
| 307 |
_LEGAL_EXHIBIT_INSTRUCTION_CACHED: Optional[str] = None
|
| 308 |
|
| 309 |
def _get_legal_exhibit_instruction() -> str:
|
| 310 |
-
"""Load legal exhibit instruction once;
|
| 311 |
global _LEGAL_EXHIBIT_INSTRUCTION_CACHED
|
| 312 |
if _LEGAL_EXHIBIT_INSTRUCTION_CACHED is not None:
|
| 313 |
return _LEGAL_EXHIBIT_INSTRUCTION_CACHED
|
|
@@ -315,6 +317,13 @@ def _get_legal_exhibit_instruction() -> str:
|
|
| 315 |
_LEGAL_EXHIBIT_INSTRUCTION_CACHED = _LEGAL_EXHIBIT_PROMPT_PATH.read_text(encoding="utf-8", errors="replace")
|
| 316 |
else:
|
| 317 |
_LEGAL_EXHIBIT_INSTRUCTION_CACHED = "When referencing evidence use Exhibit [Letter][Number] (DB-[N]) — [Filename]. Do not use bare DB-[●]."
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 318 |
return _LEGAL_EXHIBIT_INSTRUCTION_CACHED
|
| 319 |
|
| 320 |
@app.get("/prompts/legal-exhibit-instruction")
|
|
|
|
| 303 |
|
| 304 |
|
| 305 |
# Legal document exhibit reference instruction — injected into every generate/chat so edit sources always get it
|
| 306 |
+
_prompts_dir = Path(__file__).resolve().parent / "prompts"
|
| 307 |
+
_LEGAL_EXHIBIT_PROMPT_PATH = _prompts_dir / "legal_exhibit_instruction.txt"
|
| 308 |
+
_FULL_EVIDENCE_REF_PATH = _prompts_dir / "full_evidence_reference.txt"
|
| 309 |
_LEGAL_EXHIBIT_INSTRUCTION_CACHED: Optional[str] = None
|
| 310 |
|
| 311 |
def _get_legal_exhibit_instruction() -> str:
|
| 312 |
+
"""Load legal exhibit instruction once; append full evidence list when present. Injected into all LLM requests."""
|
| 313 |
global _LEGAL_EXHIBIT_INSTRUCTION_CACHED
|
| 314 |
if _LEGAL_EXHIBIT_INSTRUCTION_CACHED is not None:
|
| 315 |
return _LEGAL_EXHIBIT_INSTRUCTION_CACHED
|
|
|
|
| 317 |
_LEGAL_EXHIBIT_INSTRUCTION_CACHED = _LEGAL_EXHIBIT_PROMPT_PATH.read_text(encoding="utf-8", errors="replace")
|
| 318 |
else:
|
| 319 |
_LEGAL_EXHIBIT_INSTRUCTION_CACHED = "When referencing evidence use Exhibit [Letter][Number] (DB-[N]) — [Filename]. Do not use bare DB-[●]."
|
| 320 |
+
if _FULL_EVIDENCE_REF_PATH.exists():
|
| 321 |
+
try:
|
| 322 |
+
full = _FULL_EVIDENCE_REF_PATH.read_text(encoding="utf-8", errors="replace").strip()
|
| 323 |
+
if full:
|
| 324 |
+
_LEGAL_EXHIBIT_INSTRUCTION_CACHED = _LEGAL_EXHIBIT_INSTRUCTION_CACHED + "\n\nFull evidence list (use for every cite):\n" + full
|
| 325 |
+
except Exception:
|
| 326 |
+
pass
|
| 327 |
return _LEGAL_EXHIBIT_INSTRUCTION_CACHED
|
| 328 |
|
| 329 |
@app.get("/prompts/legal-exhibit-instruction")
|