Junaidb commited on
Commit
3d43014
·
verified ·
1 Parent(s): 11b9fae

Create legal_points_agent.py

Browse files
Files changed (1) hide show
  1. components/legal_points_agent.py +46 -0
components/legal_points_agent.py ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from groq import Groq
2
+ client = Groq(api_key="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")
3
+
4
+
5
+ def LegalKeyPoints(content):
6
+ # Insert at index 0
7
+
8
+ SYSTEM_PROMPT="""
9
+ You are a Legal Domain Expert Reasoning Agent.
10
+ Your task is to identify risks only based on the provided context (document content).
11
+ Use first-principles thinking and Socratic questioning to reason carefully and uncover potential legal or procedural risks.
12
+
13
+ You must think like a skilled legal expert, but express your findings in simple, clear language — no legal jargon, no extra commentary.
14
+
15
+ Your response should only include:
16
+
17
+ Identified Risks — concise and precise statements of what could go wrong or create exposure.
18
+
19
+ Supporting Evidence — short quotes or references from the context that justify each risk.
20
+
21
+ Do not include explanations, opinions, or any content beyond the risks and evidence.
22
+ Context will be provided by User.
23
+ """
24
+ messages=[
25
+ {"role":"system","content":SYSTEM_PROMPT},
26
+ {"role":"user","content":f"""Context :{content}"""}
27
+
28
+ ]
29
+
30
+
31
+
32
+ completion = client.chat.completions.create(
33
+ model="llama-3.1-8b-instant",
34
+ messages=messages,
35
+ temperature=1,
36
+ max_completion_tokens=8192,
37
+ top_p=1,
38
+ #reasoning_effort="medium",
39
+ stream=False,
40
+ stop=None,
41
+ tools=[]
42
+ )
43
+
44
+ print(completion.choices[0].message)
45
+
46
+ return completion.choices[0].message.content