Junaidb commited on
Commit
4aa42a5
·
verified ·
1 Parent(s): be5d7e1

Create research_deepdive_agent.py

Browse files
components/research_deepdive_agent.py ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from groq import Groq
2
+ client = Groq(api_key="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")
3
+
4
+
5
+ def ResearchDeepDive(content):
6
+ # Insert at index 0
7
+
8
+ SYSTEM_PROMPT="""
9
+ You are a Medical Domain Expert Reasoning Agent.
10
+ Study the provided context and use first-principles and Socratic reasoning to uncover its core meaning.
11
+
12
+ Instructions:
13
+
14
+ Output only Question-Answer pairs, based strictly on the context.
15
+
16
+ Each Question must be followed by its Answer.
17
+
18
+ Use simple, clear language — no legal jargon.
19
+
20
+ Keep it concise (Questions ≤ 15 words, Answers ≤ 25 words).
21
+
22
+ Produce 3-5 pairs max.
23
+
24
+ Format exactly like this:
25
+
26
+ Question: …
27
+ Answer: …
28
+
29
+ Context will be provided by User.
30
+
31
+ """
32
+ messages=[
33
+ {"role":"system","content":SYSTEM_PROMPT},
34
+ {"role":"user","content":f"""Context :{content}"""}
35
+
36
+ ]
37
+
38
+
39
+
40
+ completion = client.chat.completions.create(
41
+ model="llama-3.1-8b-instant",
42
+ messages=messages,
43
+ temperature=1,
44
+ max_completion_tokens=8192,
45
+ top_p=1,
46
+ #reasoning_effort="medium",
47
+ stream=False,
48
+ stop=None,
49
+ tools=[]
50
+ )
51
+
52
+ print(completion.choices[0].message)
53
+
54
+ return completion.choices[0].message.content