Spaces:
Sleeping
Sleeping
adjust thai time zone
Browse files- llm/llm.py +2 -2
- llm/prompt.py +1 -1
- preview.json +40 -0
llm/llm.py
CHANGED
|
@@ -115,7 +115,7 @@ class VirtualNurseLLM:
|
|
| 115 |
context=context,
|
| 116 |
patient_response=patient_response,
|
| 117 |
field_descriptions=self.field_descriptions,
|
| 118 |
-
time_now=time.strftime("%Y-%m-%d %H:%M:%S")
|
| 119 |
)
|
| 120 |
self.current_context = context
|
| 121 |
self.current_prompt = messages[0].content
|
|
@@ -133,7 +133,7 @@ class VirtualNurseLLM:
|
|
| 133 |
patient_response = current_question or self.ending_text
|
| 134 |
refactor_prompt = self.create_prompt("refactor")
|
| 135 |
messages = ChatPromptTemplate.from_messages([refactor_prompt])
|
| 136 |
-
messages = messages.format_messages(patient_response="", ehr_data=self.ehr_data, chat_history=self.chat_history, time_now=time.strftime("%Y-%m-%d %H:%M:%S"))
|
| 137 |
response = self.client(messages=messages)
|
| 138 |
json_content = self.extract_json_content(response.content)
|
| 139 |
pprint(f"JSON after dumps:\n{json_content}\n")
|
|
|
|
| 115 |
context=context,
|
| 116 |
patient_response=patient_response,
|
| 117 |
field_descriptions=self.field_descriptions,
|
| 118 |
+
time_now=time.strftime("%Y-%m-%d %H:%M:%S", time.gmtime(time.time() + 7*3600))
|
| 119 |
)
|
| 120 |
self.current_context = context
|
| 121 |
self.current_prompt = messages[0].content
|
|
|
|
| 133 |
patient_response = current_question or self.ending_text
|
| 134 |
refactor_prompt = self.create_prompt("refactor")
|
| 135 |
messages = ChatPromptTemplate.from_messages([refactor_prompt])
|
| 136 |
+
messages = messages.format_messages(patient_response="", ehr_data=self.ehr_data, chat_history=self.chat_history, time_now=time.strftime("%Y-%m-%d %H:%M:%S", time.gmtime(time.time() + 7*3600)))
|
| 137 |
response = self.client(messages=messages)
|
| 138 |
json_content = self.extract_json_content(response.content)
|
| 139 |
pprint(f"JSON after dumps:\n{json_content}\n")
|
llm/prompt.py
CHANGED
|
@@ -109,7 +109,7 @@ TASK_INSTRUCTIONS = {
|
|
| 109 |
"คนไข้: ชื่อ ธนานนท์ ศักดิ์เกียรติกุลครับ"
|
| 110 |
"ขอบคุณมากที่ให้ความร่วมมือค่ะ คุณต้อม คำถามต่อไปอยากจะถามว่าคุณต้อมอายุเท่าไหร่คะ?"
|
| 111 |
"คนไข้: อายุ 50 ครับ แต่ไม่เห็นต้องถามอะไรเยอะแยะแบบนี้เลย\n"
|
| 112 |
-
"ขอบคุณคุณต้อมสำหรับข้อมูลนะคะ ดิฉันเข้าใจค่ะว่าคุณต้อมอาจจะไม่สะดวกใจ แต่การถามคำถามทุกข้อเป็นสิ่งสำคัญค่ะ
|
| 113 |
"คนไข้: ใช่ครับ\n"
|
| 114 |
"ขอบคุณค่ะ สำหรับข้อมูลค่ะ ตอนนี้ขอถามเรื่องอาการหลักหน่อยนะคะ คุณต้อมมีอาการอะไรบ้างที่รู้สึกไม่สบายใจตอนนี้คะ?\n"
|
| 115 |
"คนไข้: จริง ๆ ก็ไม่รู้จะพูดว่าอะไรดีครับ ผมแค่รู้สึกไม่ค่อยสบาย\n"
|
|
|
|
| 109 |
"คนไข้: ชื่อ ธนานนท์ ศักดิ์เกียรติกุลครับ"
|
| 110 |
"ขอบคุณมากที่ให้ความร่วมมือค่ะ คุณต้อม คำถามต่อไปอยากจะถามว่าคุณต้อมอายุเท่าไหร่คะ?"
|
| 111 |
"คนไข้: อายุ 50 ครับ แต่ไม่เห็นต้องถามอะไรเยอะแยะแบบนี้เลย\n"
|
| 112 |
+
"ขอบคุณคุณต้อมสำหรับข้อมูลนะคะ ดิฉันเข้าใจค่ะว่าคุณต้อมอาจจะไม่สะดวกใจ แต่การถามคำถามทุกข้อเป็นสิ่งสำคัญค่ะ เดี๋ยวข้อมูลนี้จะมีประโยชน์กับคุณหมอนะคะ ต่อไปนะคะ ขออนุญาติถามเพื่อความแน่ใจ คุณต้อมเป็นเพศชายใช่ไหมคะ?\n"
|
| 113 |
"คนไข้: ใช่ครับ\n"
|
| 114 |
"ขอบคุณค่ะ สำหรับข้อมูลค่ะ ตอนนี้ขอถามเรื่องอาการหลักหน่อยนะคะ คุณต้อมมีอาการอะไรบ้างที่รู้สึกไม่สบายใจตอนนี้คะ?\n"
|
| 115 |
"คนไข้: จริง ๆ ก็ไม่รู้จะพูดว่าอะไรดีครับ ผมแค่รู้สึกไม่ค่อยสบาย\n"
|
preview.json
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"patient": {
|
| 3 |
+
"name": {
|
| 4 |
+
"prefix": "นาย",
|
| 5 |
+
"firstname": "สมชาย",
|
| 6 |
+
"surname": "ใจดี"
|
| 7 |
+
},
|
| 8 |
+
"age": 45,
|
| 9 |
+
"gender": "ชาย"
|
| 10 |
+
},
|
| 11 |
+
"medical_history": {
|
| 12 |
+
"chief_complaint": ["ปวดหัว", "มีไข้สูง"],
|
| 13 |
+
"present_illness": [
|
| 14 |
+
"เริ่มมีอาการปวดหัวเมื่อ 3 วันที่แล้ว",
|
| 15 |
+
"ไข้ขึ้นสูง 39 องศาเมื่อวานนี้",
|
| 16 |
+
"มีอาการอ่อนเพลียและไอเล็กน้อย"
|
| 17 |
+
],
|
| 18 |
+
"past_illness": ["เบาหวาน", "ภูมิแพ้ละอองเกสร"],
|
| 19 |
+
"family_history": [
|
| 20 |
+
{
|
| 21 |
+
"relation": "พ่อ",
|
| 22 |
+
"condition": "โรคหัวใจ"
|
| 23 |
+
},
|
| 24 |
+
{
|
| 25 |
+
"relation": "แม่",
|
| 26 |
+
"condition": "ความดันโลหิตสูง"
|
| 27 |
+
}
|
| 28 |
+
]
|
| 29 |
+
},
|
| 30 |
+
"personal_history": [
|
| 31 |
+
{
|
| 32 |
+
"type": "พฤติกรรม",
|
| 33 |
+
"description": "สูบบุหรี่วันละ 10 มวน"
|
| 34 |
+
},
|
| 35 |
+
{
|
| 36 |
+
"type": "การใช้ยา",
|
| 37 |
+
"description": "รับประทาน Metformin สำหรับเบาหวาน"
|
| 38 |
+
}
|
| 39 |
+
]
|
| 40 |
+
}
|