ตัวอย่าง Prompt #1
ตัวอย่าง Prompt technique ที่ทดสอบใช้งานร่วมกับ Eidy API
ทั้งนี้ Eidy API สามารถรองรับการใช้งานด้วย Prompt technique มากกว่าตัวอย่างที่แสดงไว้
สามารถใช้งาน Prompt technique ร่วมกับ OpenAI (GPT), Anthropic (Claude), Vertex (Gemini) ได้เหมือนกัน
Prompt technique
Vanilla
import requests
import json
URL = 'https://api.eidy.cloud/v1/chat/completions'
EIDY_API_KEY = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
headers = {'content-type': 'application/json', 'Authorization': 'Bearer '+ EIDY_API_KEY}
message = [{
'role': 'user',
'content': 'ชาย 40 ปี ปวดหัวทันทีและอ่อนเรื่องข้างขวา ตอนนี้ Pupil left 5 mm. Pupil right 3 mm. Please give diagnosis and next step for further investigation. Audience is general practitioner docter.'
}]
data = {
"messages" : message,
"model" : 'eidy',
"max_tokens" : 1024,
"temperature" : 0.1,
"stream" : False
}
res = requests.post(URL, headers=headers ,data=json.dumps(data))
response
{'id': '1719064593.577327-eidy',
'choices': [{'finish_reason': 'stop',
'index': 0,
'message': {'content': "Based on the symptoms described, the patient is experiencing sudden onset headache and weakness on the right side. Additionally, there is a difference in pupil size, with the left pupil measuring 5 mm and the right pupil measuring 3 mm. These symptoms are concerning for a possible neurological condition. One potential diagnosis to consider is an acute ischemic stroke. The next step for further investigation would be to perform a neurological examination, including assessing the patient's cranial nerves, motor strength, sensation, and coordination. This will help determine the extent of the neurological deficit and localize the area of involvement. Additionally, imaging studies such as a CT scan or MRI of the brain should be ordered to evaluate for any signs of acute ischemic stroke or other possible causes. It is important to note that this is just a preliminary assessment based on the information provided. A thorough evaluation by a healthcare professional is necessary to confirm the diagnosis and determine the appropriate course of treatment.",
'role': 'assistant'},
'text': "Based on the symptoms described, the patient is experiencing sudden onset headache and weakness on the right side. Additionally, there is a difference in pupil size, with the left pupil measuring 5 mm and the right pupil measuring 3 mm. These symptoms are concerning for a possible neurological condition. One potential diagnosis to consider is an acute ischemic stroke. The next step for further investigation would be to perform a neurological examination, including assessing the patient's cranial nerves, motor strength, sensation, and coordination. This will help determine the extent of the neurological deficit and localize the area of involvement. Additionally, imaging studies such as a CT scan or MRI of the brain should be ordered to evaluate for any signs of acute ischemic stroke or other possible causes. It is important to note that this is just a preliminary assessment based on the information provided. A thorough evaluation by a healthcare professional is necessary to confirm the diagnosis and determine the appropriate course of treatment."}],
'created': 1719064593.577327,
'model': 'eidy',
'object': 'chat.completion',
'usage': {'completion_tokens': 192,
'prompt_tokens': 170,
'total_tokens': 362}}
COT
import requests
import json
URL = 'https://api.eidy.cloud/v1/chat/completions'
EIDY_API_KEY = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
headers = {'content-type': 'application/json', 'Authorization': 'Bearer '+ EIDY_API_KEY}
message = [{
'role': 'user',
'content': 'ชาย 40 ปี ปวดหัวทันทีและอ่อนเรื่องข้างขวา ตอนนี้ Pupil left 5 mm. Pupil right 3 mm. Please give diagnosis and next step for further investigation. Audience is general practitioner docter. Let's think step by step.'
}]
data = {
"messages" : message,
"model" : 'eidy',
"max_tokens" : 1024,
"temperature" : 0.1,
"stream" : False
}
res = requests.post(URL, headers=headers ,data=json.dumps(data))
response
{'id': '1719064669.5414598-eidy',
'choices': [{'finish_reason': 'stop',
'index': 0,
'message': {'content': 'Based on the symptoms described, the patient is experiencing sudden onset headache and weakness on the right side. Additionally, there is a difference in pupil size, with the left pupil measuring 5 mm and the right pupil measuring 3 mm. These symptoms are concerning for a possible neurological condition. Given the sudden onset of symptoms and the presence of weakness on one side, it is important to consider the possibility of a stroke. The next step for further investigation would be to perform a neurological examination. This will help assess the extent of weakness, evaluate other cranial nerves, and identify any additional signs of neurological dysfunction. Following the neurological examination, imaging studies such as a CT scan or MRI of the brain may be necessary to determine the cause of the symptoms. It is crucial to rule out other potential causes of these symptoms, such as intracranial hemorrhage, ischemic stroke, or transient ischemic attack (TIA). Therefore, the diagnosis at this stage is suspected acute stroke, and the next step for further investigation is a neurological examination followed by imaging studies. Please note that this is a preliminary assessment based on the information provided. A thorough evaluation by a healthcare professional is necessary for an accurate diagnosis and appropriate management.',
'role': 'assistant'},
'text': 'Based on the symptoms described, the patient is experiencing sudden onset headache and weakness on the right side. Additionally, there is a difference in pupil size, with the left pupil measuring 5 mm and the right pupil measuring 3 mm. These symptoms are concerning for a possible neurological condition. Given the sudden onset of symptoms and the presence of weakness on one side, it is important to consider the possibility of a stroke. The next step for further investigation would be to perform a neurological examination. This will help assess the extent of weakness, evaluate other cranial nerves, and identify any additional signs of neurological dysfunction. Following the neurological examination, imaging studies such as a CT scan or MRI of the brain may be necessary to determine the cause of the symptoms. It is crucial to rule out other potential causes of these symptoms, such as intracranial hemorrhage, ischemic stroke, or transient ischemic attack (TIA). Therefore, the diagnosis at this stage is suspected acute stroke, and the next step for further investigation is a neurological examination followed by imaging studies. Please note that this is a preliminary assessment based on the information provided. A thorough evaluation by a healthcare professional is necessary for an accurate diagnosis and appropriate management.'}],
'created': 1719064669.5414598,
'model': 'eidy',
'object': 'chat.completion',
'usage': {'completion_tokens': 249,
'prompt_tokens': 176,
'total_tokens': 425}}
Comparison
Based on the symptoms described, the patient is experiencing sudden onset headache and weakness on the right side. Additionally, there is a difference in pupil size, with the left pupil measuring 5 mm and the right pupil measuring 3 mm.
These symptoms are concerning for a possible neurological condition. One potential diagnosis to consider is an acute ischemic stroke.
The next step for further investigation would be to perform a neurological examination, including assessing the patient's cranial nerves, motor strength, sensation, and coordination.
This will help determine the extent of the neurological deficit and localize the area of involvement.
Additionally, imaging studies such as a CT scan or MRI of the brain should be ordered to evaluate for any signs of acute ischemic stroke or other possible causes.
It is important to note that this is just a preliminary assessment based on the information provided.
A thorough evaluation by a healthcare professional is necessary to confirm the diagnosis and determine the appropriate course of treatment.
Based on the symptoms described, the patient is experiencing sudden onset headache and weakness on the right side. Additionally, there is a difference in pupil size, with the left pupil measuring 5 mm and the right pupil measuring 3 mm. These symptoms are concerning for a possible neurological condition.
Given the sudden onset of symptoms and the presence of weakness on one side, it is important to consider the possibility of a stroke.
The next step for further investigation would be to perform a neurological examination.
This will help assess the extent of weakness, evaluate other cranial nerves, and identify any additional signs of neurological dysfunction.
Following the neurological examination, imaging studies such as a CT scan or MRI of the brain may be necessary to determine the cause of the symptoms.
It is crucial to rule out other potential causes of these symptoms, such as intracranial hemorrhage, ischemic stroke, or transient ischemic attack (TIA).
Therefore, the diagnosis at this stage is suspected acute stroke, and the next step for further investigation is a neurological examination followed by imaging studies. Please note that this is a preliminary assessment based on the information provided.
A thorough evaluation by a healthcare professional is necessary for an accurate diagnosis and appropriate management.
Customize JSON Output
Prompt
import requests
import json
URL = 'https://api.eidy.cloud/v1/chat/completions'
EIDY_API_KEY = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
headers = {'content-type': 'application/json', 'Authorization': 'Bearer '+ EIDY_API_KEY}
message = [{
'role': 'user',
'content': """
<text> ผู้หญิงอายุ 32 ปี ปวดหัวตัวร้อนมา 3 วัน ทานพาราแล้วไข้ไม่ลง <text>
สรุปข้อมูลภายใน <text> เป็น OPD Note โดยใช้ JSON Structure ดังต่อไปนี้
{
"Gender" : ["Male","Female"],
"Symptom" : "Description of symptom",
"Duration" : "Duration of abnormal"
}
------------------------------------------------------------
ตอบกลับตามข้อมูลตาม JSON Structure
{
"Gender" :
"""
}]
data = {
"messages" : message,
"model" : 'eidy',
"max_tokens" : 128,
"temperature" : 0.1,
"stream" : False
}
res = requests.post(URL, headers=headers ,data=json.dumps(data))
Response
{'id': '1719065558.3024619-eidy',
'choices': [{'finish_reason': 'stop',
'index': 0,
'message': {'content': '"Female",\n "Symptom" : "Headache with fever",\n "Duration" : "3 days"\n }',
'role': 'assistant'},
'text': '"Female",\n "Symptom" : "Headache with fever",\n "Duration" : "3 days"\n }'}],
'created': 1719065558.3024619,
'model': 'eidy',
'object': 'chat.completion',
'usage': {'completion_tokens': 26, 'prompt_tokens': 239, 'total_tokens': 265}}
Last updated