Spaces:
Sleeping
Sleeping
Create responser.py
Browse files- responser.py +22 -0
responser.py
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import os
|
2 |
+
|
3 |
+
from groq import Groq
|
4 |
+
|
5 |
+
def res(prompt):
|
6 |
+
prompt = "Being a reknowned Doctor, Please Answer the question : " + prompt
|
7 |
+
|
8 |
+
client = Groq(
|
9 |
+
api_key=os.environ["key"],
|
10 |
+
)
|
11 |
+
|
12 |
+
chat_completion = client.chat.completions.create(
|
13 |
+
messages=[
|
14 |
+
{
|
15 |
+
"role": "user",
|
16 |
+
"content": prompt,
|
17 |
+
}
|
18 |
+
],
|
19 |
+
model="llama3-8b-8192",
|
20 |
+
)
|
21 |
+
|
22 |
+
return (chat_completion.choices[0].message.content)
|