Prompt 文字指令

在現代醫療環境中,醫護人員面臨著繁重的病患照護和紀錄工作。為了提升工作效率,我們醫院已導入 ChatGPT 以及相關自動化工具,協助醫護人員利用 prompt 進行病患照護和紀錄。本篇簡介旨在幫助員工快速了解如何有效使用這些工具。

生成式 AI 概論

結構化工具可由三個途徑使用 生成式 AI 工具

  1. LLM 控制項 可制定提示詞預設使用 Llama3.1 8B 模型推論,詳見 LLM 控制項說明

  2. 巨集按鈕 使用 LLMQUERY() 函數指定,可選用不同語言模型: 詳見 LLMQUERY 函數 說明。

  3. 使用 AI 小助手 : 開箱即用體驗 LLM 預設功能,也可選用其他助手表單,詳見 AI 小助手 說明。

什麼是 Prompt 提示詞

Prompt 是一段簡短的文字指令,用於引導大語言模型(如 ChatGPT)生成所需的內容。大語言工具可以理解並生成自然語言,協助醫護人員快速完成紀錄、分析病患資料以及提供診斷建議。例如針對病史紀錄 Prompt: 請紀錄病患A的病史,包括過去的重大疾病、手術、過敏史及家族病史。ChatGPT 會生成一段完整的病史紀錄,醫護人員只需核對和補充細節。或是針對病程記錄 Prompt: 更新病患A的病程紀錄,描述最近一次就診的情況、診斷結果及治療方案。ChatGPT 會生成詳細的病程更新紀錄。也可針對護理紀錄 Prompt: 紀錄病患A今天的護理情況,包括生命體徵、護理措施及病患反應。ChatGPT 會生成一段詳細的護理紀錄,方便護理人員查看和追蹤。

避免幻覺的提示指令技巧

  • Llama3.1 8B context window 高達 128K,對於整理長病歷內容極有幫助,但考量算力資源,醫院保守設為 32K。提問公式可設定防呆,比如參考資料太少時,請不要回應 (範例 4),例如: 利用邏輯判斷 IF(LEN(A35) < 10,"do not response", 當A35 長度小於 10 請不要回應。建議每次對話都使用新的參考資料。

  • System prompt 預設清除先前記憶,這是為了避免接續問不同病人問題產生混淆。對話方式設定為提示 生成回應,不是對話模式,僅針對單次對話提問回應,就像診間問診對話情境,提示對話回應僅限本次內容,不要參雜上一個病人對話,prompt 文字指令可說明 "以本對話提供的內容 (範例 2) 進行分析或是整理",例如 summarize only the information from the above record 以避免參雜其他人的對話。

  • 當沒有相關資料時,可回應 "無相關資料 not available" (範例 2) ,例如 if there is no material related to present illness, respond not available 減少幻覺。

  • 針對提供的參考資料,例如檢驗 HIS參照 回傳的資料,若內容有規則可循,可在文字指令中說明資料格式 (範例 4),例如 the above test information may contain multiple serial tests on a different date, you should search backward for YYYYMMDD as the test date. 可大大提升機器人閱讀理解能力,避免誤解資料內容。

範例說明

  • 最簡單的方式是在 LLM 控制項 直接使用句子提問 (範例 1),或是使用函數組合提示詞 (範例 2)

  • 若要使用不同模型,可利用 擴充函數LLMQUERY(id, prompt, model) 函數,制定提示詞 prompt,以及使用 model 模型,提問後生成結果可回傳到 id 控制項 (範例 3) 。

  • LLMquery 內的提示詞,也可利用 內建邏輯函數 IF 進行判斷組合,提供更多控制選擇 (範例 4)。

  • 若要使用多輪對話,或是多步驟執行代理人生成式AI,可利用巨集按鈕,以 "逗號" 分割不同函數步驟,依序自動執行多個 LLMquery 函數指令 (範例 5)。

  • 其他細節可參閱 大語言函數 說明。

範例 1

LLM 控制項 使用句子提問

// prompt

"Please explain to me about metabolic syndrome"

解釋: 利用 LLMQUERY 進行 ChatGPT 詢問,代謝症候群是什麼。

範例 2

LLM 控制項 中使用 CONCATENATE() 組合文字提問

// prompt

CONCATENATE("Please analysis the following medical records: ",A16," Now, summarize only the information from the above record and only the present illness within 50 words, if there is no material related to present illness, respond not available, Only provide the answer, and ignore opening or additional content.")

解釋: 利用 CONCATENATE 組合出文字提示: 請分析 A16 病歷紀錄,以小於 50 字長度整理 present illness,如果沒有相關資料請回答無相關內容,回應請忽略開場或是額外內容

範例 3

巨集按鈕控制項 中使用 LLMQUERY() 函數提問:

// prompt

LLMQUERY(31, CONCATENATE("Please analysis the following medical records: ",A16," Now, summarize only the information from the above record and only the present illness within 50 words, if there is no material related to present illness, respond not available, Only provide the answer, and ignore opening or additional content."))

解釋: 利用 LLMQUERY 進行 ChatGPT 詢問,請分析 A16 病歷紀錄,以小於 50 字長度整理 present illness,如果沒有相關資料請回答無相關內容,回應請忽略開場或是額外內容

範例 4

巨集按鈕控制項 中使用 邏輯判斷 提問

// prompt

LLMQUERY(59,IF(LEN(A16) < 10,"response not available",CONCATENATE("Read the medical record as follow: ",A16, " Now, analysis the following lab test data: ",A58," the above test information may contain multiple serial tests on a different date, you should search backward for YYYYMMDD as the test date. After analysis, respond with the following format, in first paragraph, provide items of Lab tests contains results in the format of lab test name, data value, (YYYY/MM/DD) related to the active problem within the medical records no more than 50 words, second paragraph is a Summary to explain the lab result with no more than 50 words, Only provide the answer, and ignore opening or additional content."))),

解釋: 在 LLMQUERY 內的 prompt 參數導入邏輯判斷, LLMQUERY(59,IF(LEN(A16) < 10,'不要回應',CONCATENATE('閱讀以下的病歷:',A16, '現在,分析以下的實驗室測試資料:',A58,' 上述的測試資訊可能包含多個不同日期的連續測試,您應該向前搜索以 YYYYMMDD 作為測試日期。分析後,回應以下格式,僅提供兩項,第一項是最近的實驗室測試結果的Lab測試名稱、數據值、(YYYY/MM/DD) 與醫療記錄中的活躍問題相關,不超過 50 個字,第二項是解釋實驗室結果的摘要,不超過 50 個字,僅提供答案,並忽略開頭或其他內容。')))

範例 5

巨集按鈕控制項 中使用 批次多函數指令,依序自動化執行多個函數指令

// prompt

LLMQUERY(39,IF(LEN(A16) < 10,"response not available",CONCATENATE("remove previous memory, and analysis the following medical records: ",A16," Now, summarize only the information from the above record into summary of present illness, past history, and active problem, please response not available if there is no related information. Only provide the answer, and ignore opening or additional content."))),

LLMQUERY(39, IF(LEN(A41) < 10,"clinical question not available",CONCATENATE(A39, " According the above medical record, answer the clinical question: what is the the most appropriate imaging study to evaluate his/her ", A41, " and associated symptoms base on the ACR Select criteria? please also explain the reason")))

解釋: 巨集按鈕可利用 "逗號" 分割不同步驟,依序執行兩個 LLMQUERY(),以上範例先調用 生成式AI工具,回答病歷整理,將結果放到控制項 39,再調用 生成式AI工具 依照 控制項 39 的結果,詢問臨床問題以及建議的檢查,再將結果放回 控制項 39。

請注意,巨集中若有多個 LLMQUERY() ,不管邏輯分支是否觸及都會執行,所以邏輯判斷需要放在 LLMQUERY() 提示文字 prompt 參數裡面。

其他學習資源

Last updated