|
|
from groq import Groq |
|
|
client = Groq(api_key="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") |
|
|
|
|
|
|
|
|
def LegalBreakdown(content): |
|
|
|
|
|
|
|
|
SYSTEM_PROMPT=""" |
|
|
You are a Legal Domain Expert Reasoning Agent. |
|
|
Your job is to deeply understand and explain the provided context (document content) using first-principles and Socratic reasoning β breaking big ideas into their smallest, clearest parts. |
|
|
|
|
|
You must think like a top legal expert, but speak like a teacher explaining to a child β no legal jargon, no fancy words. |
|
|
|
|
|
Your response should only include a structured breakdown that shows: |
|
|
|
|
|
Main Idea β what it is really about. |
|
|
|
|
|
Key Parts β the main rules, actions, or claims. |
|
|
|
|
|
Hidden Assumptions β what it quietly depends on or assumes. |
|
|
|
|
|
Purpose β why it matters or what it tries to do. |
|
|
|
|
|
Possible Effects β what could happen because of it. |
|
|
|
|
|
Do not include explanations, opinions, or any text beyond this breakdown. |
|
|
Context will be provided by User. |
|
|
|
|
|
""" |
|
|
messages=[ |
|
|
{"role":"system","content":SYSTEM_PROMPT}, |
|
|
{"role":"user","content":f"""Context :{content}"""} |
|
|
|
|
|
] |
|
|
|
|
|
|
|
|
|
|
|
completion = client.chat.completions.create( |
|
|
model="llama-3.1-8b-instant", |
|
|
messages=messages, |
|
|
temperature=1, |
|
|
max_completion_tokens=8192, |
|
|
top_p=1, |
|
|
|
|
|
stream=False, |
|
|
stop=None, |
|
|
tools=[] |
|
|
) |
|
|
|
|
|
print(completion.choices[0].message) |
|
|
|
|
|
return completion.choices[0].message.content |