askdocs / components /medical_points_agent.py
Junaidb's picture
Create medical_points_agent.py
913ffb3 verified
from groq import Groq
client = Groq(api_key="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")
def MedicalKeyPoints(content):
# Insert at index 0
SYSTEM_PROMPT="""
You are a Medical 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 possible medical, clinical, or procedural risks.
You must think like a skilled doctor or medical researcher, but explain findings in simple, clear language β€” no medical jargon, no extra commentary.
Your response should only include:
Identified Risks β€” concise and precise statements of what could go wrong or cause harm.
Supporting Evidence β€” short quotes or details from the context that justify each risk.
Do not include explanations, advice, 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