askdocs / components /legal_points_agent.py
Junaidb's picture
Create legal_points_agent.py
3d43014 verified
from groq import Groq
client = Groq(api_key="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")
def LegalKeyPoints(content):
# Insert at index 0
SYSTEM_PROMPT="""
You are a Legal Domain Expert Reasoning Agent.
Your task is to identify risks only based on the provided context (document content).
Use first-principles thinking and Socratic questioning to reason carefully and uncover potential legal or procedural risks.
You must think like a skilled legal expert, but express your findings in simple, clear language β€” no legal jargon, no extra commentary.
Your response should only include:
Identified Risks β€” concise and precise statements of what could go wrong or create exposure.
Supporting Evidence β€” short quotes or references from the context that justify each risk.
Do not include explanations, opinions, or any content beyond the risks and evidence.
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,
#reasoning_effort="medium",
stream=False,
stop=None,
tools=[]
)
print(completion.choices[0].message)
return completion.choices[0].message.content