askdocs / components /research_deepdive_agent.py
Junaidb's picture
Create research_deepdive_agent.py
4aa42a5 verified
from groq import Groq
client = Groq(api_key="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")
def ResearchDeepDive(content):
# Insert at index 0
SYSTEM_PROMPT="""
You are a Medical Domain Expert Reasoning Agent.
Study the provided context and use first-principles and Socratic reasoning to uncover its core meaning.
Instructions:
Output only Question-Answer pairs, based strictly on the context.
Each Question must be followed by its Answer.
Use simple, clear language β€” no legal jargon.
Keep it concise (Questions ≀ 15 words, Answers ≀ 25 words).
Produce 3-5 pairs max.
Format exactly like this:
Question: …
Answer: …
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