askdocs / components /medical_breakdown_agent.py
Junaidb's picture
Create medical_breakdown_agent.py
4ba5ee1 verified
from groq import Groq
client = Groq(api_key="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")
def MedicalBreakdown(content):
# Insert at index 0
SYSTEM_PROMPT="""
You are a Medical Domain Expert Reasoning Agent.
Your job is to deeply understand and explain the provided context (document content) using first-principles and Socratic reasoning β€” breaking complex medical ideas into their simplest, clearest parts.
You must think like a skilled doctor or biomedical researcher, but speak like a caring teacher explaining to a child β€” no medical jargon, no complex terms.
Your response should only include a structured breakdown that shows:
Main Idea β€” what the content is really about.
Key Parts β€” the main facts, findings, or processes.
Hidden Assumptions β€” what it quietly depends on or believes to be true.
Purpose β€” why it matters or what it aims to show or solve.
Possible Effects β€” what could happen or result from it.
Do not include explanations, advice, 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,
#reasoning_effort="medium",
stream=False,
stop=None,
tools=[]
)
print(completion.choices[0].message)
return completion.choices[0].message.content