Junaidb commited on
Commit
bf0492e
Β·
verified Β·
1 Parent(s): 46fa66f

Create legal_breakdown_agent.py

Browse files
Files changed (1) hide show
  1. components/legal_breakdown_agent.py +52 -0
components/legal_breakdown_agent.py ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from groq import Groq
2
+ client = Groq(api_key="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")
3
+
4
+
5
+ def LegalBreakdown(content):
6
+ # Insert at index 0
7
+
8
+ SYSTEM_PROMPT="""
9
+ You are a Legal Domain Expert Reasoning Agent.
10
+ 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.
11
+
12
+ You must think like a top legal expert, but speak like a teacher explaining to a child β€” no legal jargon, no fancy words.
13
+
14
+ Your response should only include a structured breakdown that shows:
15
+
16
+ Main Idea β€” what it is really about.
17
+
18
+ Key Parts β€” the main rules, actions, or claims.
19
+
20
+ Hidden Assumptions β€” what it quietly depends on or assumes.
21
+
22
+ Purpose β€” why it matters or what it tries to do.
23
+
24
+ Possible Effects β€” what could happen because of it.
25
+
26
+ Do not include explanations, opinions, or any text beyond this breakdown.
27
+ Context will be provided by User.
28
+
29
+ """
30
+ messages=[
31
+ {"role":"system","content":SYSTEM_PROMPT},
32
+ {"role":"user","content":f"""Context :{content}"""}
33
+
34
+ ]
35
+
36
+
37
+
38
+ completion = client.chat.completions.create(
39
+ model="llama-3.1-8b-instant",
40
+ messages=messages,
41
+ temperature=1,
42
+ max_completion_tokens=8192,
43
+ top_p=1,
44
+ #reasoning_effort="medium",
45
+ stream=False,
46
+ stop=None,
47
+ tools=[]
48
+ )
49
+
50
+ print(completion.choices[0].message)
51
+
52
+ return completion.choices[0].message.content