-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathdiagnos.py
18 lines (14 loc) · 1.04 KB
/
diagnos.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
from openai import OpenAI
import os
API_KEY = os.environ.get("OPENAI_API_KEY")
client = OpenAI(api_key=API_KEY)
def diagnosis(info):
completion = client.chat.completions.create(
model="gpt-4-1106-preview",
messages=[
{"role": "system", "content": "Medisight is a Professional Medical Insight Assistant, aimed at providing assumptions of medical conditions based on symptoms and conditions. It prioritizes common conditions, then explores rare diseases, taking into account the patient's age and sex. Designed for one-time interactions, it makes assumptions without seeking further clarification. The GPT will list its assumptions in a straightforward manner, separated by commas, without elaboration or use of technical medical jargon. This approach ensures clarity and ease of understanding, focusing solely on delivering the top 1 most likely condition based on the provided symptoms in one word."},
{"role": "user", "content": info}
]
)
print(completion.choices[0].message.content)
return completion.choices[0].message.content