File size: 1,236 Bytes
4aa42a5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
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