Spaces:
Sleeping
Sleeping
Upload folder using huggingface_hub
Browse files- Dockerfile +0 -3
- src/llm.py +3 -14
Dockerfile
CHANGED
|
@@ -1,6 +1,3 @@
|
|
| 1 |
-
# open Dockerfile and add this line anywhere
|
| 2 |
-
# rebuild trigger
|
| 3 |
-
|
| 4 |
FROM python:3.11-slim
|
| 5 |
|
| 6 |
WORKDIR /app
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
FROM python:3.11-slim
|
| 2 |
|
| 3 |
WORKDIR /app
|
src/llm.py
CHANGED
|
@@ -25,16 +25,6 @@ Rules you must follow:
|
|
| 25 |
4. Always cite the Judgment ID when referencing a case
|
| 26 |
5. If excerpts don't contain enough information, say so explicitly
|
| 27 |
6. End every response with: "NOTE: This is not legal advice. Consult a qualified advocate."
|
| 28 |
-
|
| 29 |
-
Formatting rules — follow these exactly:
|
| 30 |
-
- Use numbered lists (1. 2. 3.) when listing multiple points or steps
|
| 31 |
-
- Use bullet points (- item) for sub-points or supporting details
|
| 32 |
-
- Use markdown tables (| Col | Col |) when comparing options side by side
|
| 33 |
-
- Use **bold** for important terms, case names, and section numbers
|
| 34 |
-
- Use headers (## Heading) to separate major sections in long answers
|
| 35 |
-
- Never write everything as one long paragraph
|
| 36 |
-
- Each distinct point must be on its own line
|
| 37 |
-
- Always put a blank line between sections
|
| 38 |
"""
|
| 39 |
|
| 40 |
@retry(
|
|
@@ -51,8 +41,7 @@ def call_llm(query: str, context: str) -> str:
|
|
| 51 |
SUPREME COURT JUDGMENT EXCERPTS:
|
| 52 |
{context}
|
| 53 |
|
| 54 |
-
Answer based only on the excerpts above. Cite judgment IDs.
|
| 55 |
-
Use proper markdown formatting — numbered lists, bullet points, tables, bold text as appropriate."""
|
| 56 |
|
| 57 |
response = _client.chat.completions.create(
|
| 58 |
model="llama-3.3-70b-versatile",
|
|
@@ -61,7 +50,7 @@ Use proper markdown formatting — numbered lists, bullet points, tables, bold t
|
|
| 61 |
{"role": "user", "content": user_message}
|
| 62 |
],
|
| 63 |
temperature=0.1,
|
| 64 |
-
max_tokens=
|
| 65 |
)
|
| 66 |
-
|
| 67 |
return response.choices[0].message.content
|
|
|
|
| 25 |
4. Always cite the Judgment ID when referencing a case
|
| 26 |
5. If excerpts don't contain enough information, say so explicitly
|
| 27 |
6. End every response with: "NOTE: This is not legal advice. Consult a qualified advocate."
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 28 |
"""
|
| 29 |
|
| 30 |
@retry(
|
|
|
|
| 41 |
SUPREME COURT JUDGMENT EXCERPTS:
|
| 42 |
{context}
|
| 43 |
|
| 44 |
+
Answer based only on the excerpts above. Cite judgment IDs."""
|
|
|
|
| 45 |
|
| 46 |
response = _client.chat.completions.create(
|
| 47 |
model="llama-3.3-70b-versatile",
|
|
|
|
| 50 |
{"role": "user", "content": user_message}
|
| 51 |
],
|
| 52 |
temperature=0.1,
|
| 53 |
+
max_tokens=800
|
| 54 |
)
|
| 55 |
+
|
| 56 |
return response.choices[0].message.content
|