本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。
地址失敗 自動原因政策測試
如果自動推理政策的測試失敗,請檢閱測試結果中擷取的邏輯和規則。根據問題,有幾種方式可以解決失敗:
注意
教學影片:如需精簡和疑難排解自動化原因政策的step-by-step演練,請觀看下列教學課程:
了解註釋
註釋是您在測試失敗時套用來修復政策的更正。如果測試未傳回您的預期結果,您可以修改測試條件、重新執行測試條件,並將成功修改套用為註釋,以更新您的政策。
使用註釋來:
修正不正確的規則
新增缺少的變數
改善變數描述
解決翻譯模棱兩可的問題
範例:政策修復註釋
問題:政策核准的休假適用於 8 個月期間的員工,但來源文件需要 1 年以上。
原始規則:
if is_full_time = true, then eligible_for_parental_leave = true
套用的註釋:
新增
years_of_service
變數 (實際類型)更新規則為:
if is_full_time = true and years_of_service >= 1.0, then eligible_for_parental_leave = true
測試現在可正確傳回 8 個月員工的 INVALID
-
更新失敗測試的條件並重新執行。如果您測試傳回預期的驗證結果,您可以套用此註釋來更新您的政策。
-
更新政策的變數名稱或描述,以協助自動推理在將自然語言轉換為邏輯時區分它們。
-
如果您認為自動化原因誤會來源文件或來源文件包含錯誤,請更新政策的規則。
-
透過新增變數和類型來編輯政策的邏輯。然後,您可以更新規則以使用新的變數。這是我們通常不建議的進階使用案例。
-
使用更全面的說明重新建立您的政策。這些指示應包含足夠的內容,以便自動推理可以擷取與您的應用程式使用方式相關的邏輯。我們也建議包含您預期會被詢問有關來源文件的範例問題和答案。
當無法提供指引時
在某些情況下,自動推理可能表示無法為失敗的測試提供指引。這通常發生在政策結構存在基本問題而無法進行明確分析時。發生這種情況時,您應該檢查政策規則並尋找衝突。
無法提供指引的常見案例包括:
-
衝突規則:您的政策包含建立邏輯不一致的衝突規則。例如,一個規則可能指出全職員工符合休假資格,而另一個規則則指出服務少於一年的員工不符合資格,而不指定如何處理服務少於一年的全職員工。
-
不完整的規則涵蓋範圍:您的政策有差距,其中任何規則都無法解決某些條件組合,因此無法判斷正確的結果。
-
循環相依性:以建立邏輯迴圈的方式相互相依的規則,防止系統得出確定的結論。
-
過於複雜的規則互動:當多個規則以針對特定測試案例建立模棱兩可或矛盾結果的方式互動時。
若要解決這些問題:
-
有系統地檢閱您的政策規則:瀏覽政策中的每個規則,並識別任何可能與其他人衝突的規則。尋找可能適用於相同案例但產生不同結果的規則。
-
檢查規則完整性:確保您的規則涵蓋網域中可能發生的所有可能條件組合。識別未套用規則的任何差距。
-
簡化複雜的互動:如果您有許多互連的規則,請考慮將它們分解成更簡單、更專注的規則,更容易理解和驗證。
-
測試邊緣案例:建立其他測試,專門針對政策中的邊界條件和邊緣案例,以識別可能存在衝突或差距的位置。
-
考慮政策重組:如果衝突持續存在,您可能需要使用更明確的規則階層或優先順序順序來重組政策,以解決模棱兩可的問題。
當您遇到這種情況時,從更簡單的政策版本開始,並在每個步驟測試以識別發生衝突的位置時逐漸增加複雜性,通常會很有幫助。
下列範例是測試可能失敗的常見原因,以及如何解決這些問題。
自動化推理不了解來源文件
常見原因
自動化理由可能尚未從您的來源文件中擷取所有必要的變數,或者變數描述可能不夠清楚,無法從自然語言正確轉譯為正式邏輯。
Resolution
-
檢閱定義畫面上的變數清單,以確認從您的問題和答案擷取事實宣告所需的所有變數都存在於您的政策中。
-
如果缺少必要的變數:
-
選擇新增以建立新的變數。
-
選取適當的類型 (bool、int、real 或 enum)。
-
撰寫清晰、全面的變數描述。
-
-
如果變數存在,但在問題和答案驗證期間未正確指派,請改善其描述,以協助自動化原因更好地翻譯自然語言。例如:
原始描述 (太有限):「每週工作超過 20 小時的員工」。
改善描述:「每週工作超過 20 小時的員工視為全職。當使用者提到「全職」或工作全時數時,將此值設為 true,當他們提到「兼職」或工作減少時數時,則設為 false。」
自動化理由政策中的規則錯誤
常見原因
自動化理由可能會誤判您的來源文件,或您的來源文件可能包含錯誤或不一致。
Resolution
-
如果驗證輸出引用不正確的規則,請編輯規則。您可能會先注意到這一點,因為測試會如預期
VALID
般回復INVALID
。 -
在規則中參考變數時,請使用政策定義區段中指定的完整變數名稱。例如,拼出
is_full_time
。如果您預期輸入 Q&A 符合特定規則,請先檢查輸入 Q&A 中的變數是否正確。如果是,您可能需要新增規則。 -
使用規則清單右上角的新增按鈕來輸入新規則。使用自然語言指定規則。首先指定限制條件,並依其全名指定參考變數。例如,對於僅允許全職員工休假的規則,文字可以是如下:「如果員工
is_full_time
,則允許他們休假、帶薪 (LoAP)」。
自動化推理政策傳回 TRANSLATION_AMBIGUOUS
常見原因
如果您的政策傳回 TRANSLATION_AMBIGUOUS
,這表示自動推理在將自然語言轉譯為正式邏輯時偵測到模棱兩可的情況。當系統無法確定如何將自然語言概念映射到政策中的正式邏輯變數和規則時,就會發生這種情況。
翻譯模棱兩可可能來自幾個基本原因:
-
重疊變數定義:當您政策中的多個變數可合理代表自然語言提及的相同概念時,系統無法判斷要使用哪個變數。例如,如果您同時有具有類似描述的
employee_tenure_years
和years_of_service
變數,則當使用者詢問「某人在公司工作多久」時,系統可能很難判斷要使用哪個變數。這會在翻譯過程中建立模棱兩可之處,並可能導致結果不一致。 -
變數描述不完整:變數描述缺少有關使用者如何以日常語言參考概念的足夠詳細資訊,因此很難將使用者輸入映射到正確的正式邏輯表示法。
-
不明確的自然語言輸入:包含模糊、矛盾或多可解譯陳述式的使用者提示或模型回應,無法明確翻譯為正式邏輯。
-
缺少內容資訊:當自然語言是指存在於您網域中的概念,但無法在政策的變數結構描述中充分表示。
-
不一致術語:當在來源文件中使用不同的術語、變數描述和使用者互動提及相同的概念時,會在翻譯期間造成混淆。
了解這些原因可協助您偵錯測試的問題,並判斷要對政策進行哪些變更。在某些情況下,您可能需要調整政策的可信度等級設定,以便在特定使用案例中的嚴格準確性和實際可用性之間取得更好的平衡。
Resolution
根據基礎問題,有幾種方法可以修正此問題:
-
變數描述太相似:當兩個變數具有類似的名稱或描述時,轉譯程序可能會不一致地在它們之間進行選擇。例如,如果您有具有類似描述的
is_full_time
和full_time_status
變數,則系統可能無法一致地將有關僱用狀態的自然語言映射到正確的變數。檢閱您的變數描述,讓每個描述都有明確區分的目的和內容。考慮將重複的概念合併為單一變數,或確保每個變數都有明確、不重疊的描述,明確地指定何時應該使用每個變數。 -
變數內容不足:您的變數描述可能無法充分涵蓋使用者如何參考網域中的概念。使用正確的內容層級更新您的變數描述。
-
不一致的值格式:當系統不確定如何格式化值 (例如數字或日期) 時,可能會發生轉換模棱兩可的情況。更新您的變數描述,以釐清預期的格式。
-
模棱兩可的輸入:如果輸入文字包含模棱兩可的陳述式,請將其修改為更精確。
您可以使用下列其中一個提示來修正翻譯模棱兩可的問題:
- 不含來源的模棱兩可性
-
You are an expert in revising answers to questions based on logical disagreements found in the answers. Given a domain, a question, an original answer, and logical ambiguities suggested from scearios, your task is to revise the original answer to address and resolve the logical ambiguities identified above. The revised answer should remove any ambiguities, such that one can clearly judge whether each scenario is consistent or inconsistent with the answer. The revised answer should have approximately the same length as the original answer. Avoid extending the answer with your own background knowledge. Below is an example. DOMAIN: DiscountPolicy QUESTION: I want to buy tickets for next Thursday. How many people are needed to qualify for your group discount? ORIGINAL ANSWER: You need at least 10 people to get the group discount. LOGICAL AMBIGUITIES FOUND: disagree_scenario1: ['(= group_size 12)', '(= advanced_booking false)', '(= group_discount true)'] (Analysis: The scenario says the group size is 12, there is no advanced booking and group discount is true. Is this consistent with the answer? Well, the original answer does not mention advanced booking. Maybe the answer assumed advanced booking from the question "I want to buy tickets for next Thursday", but that's debatable. The revised answer should make it clear.) REVISED ANSWER: You need at least 10 people and need to book in advance to get the group discount. (Note: Scenarios are illustrative cases highlighting potential ambiguities. Do not overfit in your revised answer. In the example above, you should use the original "You need at least 10 people..." rather than the scenario-specific "If you have 12 people...") Now complete the following task and return the revised answer. (Just return the answer. Do not return any analysis or notes) DOMAIN: {domain} QUESTION: {question} ORIGINAL ANSWER: {original_answer} LOGICAL AMBIGUITIES FOUND: It is unclear if the following scenarios are valid or not according to the answer. {disagreement_text} REVISED ANSWER:
- 來源的模棱兩可性
-
You are an expert in revising answers to questions based on logical disagreements found in the answers. Given a domain, a question, an original answer, a piece of policy source text, and logical ambiguities suggested from scearios, your task is to revise the original answer to address and resolve the logical ambiguities identified above. The revised answer should remove any ambiguities, such that one can clearly judge whether each scenario is consistent or inconsistent with the answer. The revised answer should have approximately the same length as the original answer. Avoid extending the answer with your own background knowledge. The revised answer should be consistent with the actual policy from the source text. Below is an example. DOMAIN: DiscountPolicy QUESTION: I want to buy tickets for next Thursday. How many people are needed to qualify for your group discount? ORIGINAL ANSWER: You need at least 10 people to get the group discount. POLICY SOURCE TEXT: ... We offer discounts to students, seniors, and large groups. Students must present a valid ID ... A group of ten or more people are qualified for a group discount. Group discount tickets must be booked in advance. Each group ticket is 20% off the regular ticket price ... LOGICAL AMBIGUITIES FOUND: disagree_scenario1: ['(= group_size 12)', '(= advanced_booking false)', '(= group_discount true)'] (Analysis: The scenario says the group size is 12, there is no advanced booking and group discount is true. Is this consistent with the answer? Well, the original answer does not mention advanced booking. Maybe the answer assumed advanced booking from the question "I want to buy tickets for next Thursday", but that's debatable. The revised answer should make it clear.) REVISED ANSWER: You need at least 10 people and need to book in advance to get the group discount. (Note: Scenarios are illustrative cases highlighting potential ambiguities. Do not overfit in your revised answer. In the example above, you should use the original "You need at least 10 people..." rather than the scenario-specific "If you have 12 people...") Now complete the following task and return the revised answer. (Just return the answer. Do not return any analysis or notes) DOMAIN: {domain} QUESTION: {question} ORIGINAL ANSWER: {original_answer} POLICY SOURCE TEXT: {policy_source_text} LOGICAL DISAGREEMENTS FOUND: It is unclear if the following scenarios are valid or not according to the answer. {disagreement_text} REVISED ANSWER: