Kappa7077 commited on
Commit
0ea06d4
·
1 Parent(s): 3573828

update prompt

Browse files
Files changed (2) hide show
  1. app.py +4 -3
  2. process.ipynb +2 -61
app.py CHANGED
@@ -29,14 +29,15 @@ checkModel = genai.GenerativeModel("gemini-2.0-flash")
29
  ########################################
30
  def need_rag_check(model, user_input):
31
  prompt = f"""
32
- 你是一個智慧客服助理。
 
 
33
  對話內容:{user_input}
34
- 是否需要從保險資料庫中查詢才能回答(如果判斷是回復個人資訊,就不用,但如果是問有甚麼推薦的保險方案或者是與保險相關的資訊,就一定要查詢資料庫)?
35
- 如需要則輸出 "YES", 否則輸出 "NO"
36
  """
37
  resp = model.generate_content(prompt)
38
  return ("YES" in resp.text.upper())
39
 
 
40
  ########################################
41
  # 載入 Chuxin Embedding 模型 (快取)
42
  ########################################
 
29
  ########################################
30
  def need_rag_check(model, user_input):
31
  prompt = f"""
32
+ 你是一個智慧客服助理,專精於保險專業資訊。
33
+ 無論使用者是詢問保險方案推薦、投保流程或其他與保險相關的專業問題,只要提到保險相關資訊,就必須查詢保險資料庫來輔助回答。
34
+ 請根據下面的對話內容,僅輸出 "YES" ,表示需要查詢資料庫;否則輸出 "NO"。
35
  對話內容:{user_input}
 
 
36
  """
37
  resp = model.generate_content(prompt)
38
  return ("YES" in resp.text.upper())
39
 
40
+
41
  ########################################
42
  # 載入 Chuxin Embedding 模型 (快取)
43
  ########################################
process.ipynb CHANGED
@@ -57,73 +57,14 @@
57
  },
58
  {
59
  "cell_type": "code",
60
- "execution_count": 4,
61
  "metadata": {},
62
  "outputs": [
63
  {
64
  "name": "stderr",
65
  "output_type": "stream",
66
  "text": [
67
- "Add of existing embedding ID: doc_001\n",
68
- "Insert of existing embedding ID: doc_001\n",
69
- "Add of existing embedding ID: doc_002\n",
70
- "Insert of existing embedding ID: doc_002\n",
71
- "Add of existing embedding ID: doc_003\n",
72
- "Insert of existing embedding ID: doc_003\n",
73
- "Add of existing embedding ID: doc_004\n",
74
- "Insert of existing embedding ID: doc_004\n",
75
- "Add of existing embedding ID: doc_005\n",
76
- "Insert of existing embedding ID: doc_005\n",
77
- "Add of existing embedding ID: doc_006\n",
78
- "Insert of existing embedding ID: doc_006\n",
79
- "Add of existing embedding ID: doc_007\n",
80
- "Insert of existing embedding ID: doc_007\n",
81
- "Add of existing embedding ID: doc_008\n",
82
- "Insert of existing embedding ID: doc_008\n",
83
- "Add of existing embedding ID: doc_009\n",
84
- "Insert of existing embedding ID: doc_009\n",
85
- "Add of existing embedding ID: doc_010\n",
86
- "Insert of existing embedding ID: doc_010\n",
87
- "Add of existing embedding ID: doc_011\n",
88
- "Insert of existing embedding ID: doc_011\n",
89
- "Add of existing embedding ID: doc_012\n",
90
- "Insert of existing embedding ID: doc_012\n",
91
- "Add of existing embedding ID: doc_013\n",
92
- "Insert of existing embedding ID: doc_013\n",
93
- "Add of existing embedding ID: doc_014\n",
94
- "Insert of existing embedding ID: doc_014\n",
95
- "Add of existing embedding ID: doc_015\n",
96
- "Insert of existing embedding ID: doc_015\n",
97
- "Add of existing embedding ID: doc_016\n",
98
- "Insert of existing embedding ID: doc_016\n",
99
- "Add of existing embedding ID: doc_017\n",
100
- "Insert of existing embedding ID: doc_017\n",
101
- "Add of existing embedding ID: doc_018\n",
102
- "Insert of existing embedding ID: doc_018\n",
103
- "Add of existing embedding ID: doc_019\n",
104
- "Insert of existing embedding ID: doc_019\n",
105
- "Add of existing embedding ID: doc_020\n",
106
- "Insert of existing embedding ID: doc_020\n",
107
- "Add of existing embedding ID: doc_021\n",
108
- "Insert of existing embedding ID: doc_021\n",
109
- "Add of existing embedding ID: doc_022\n",
110
- "Insert of existing embedding ID: doc_022\n",
111
- "Add of existing embedding ID: doc_023\n",
112
- "Insert of existing embedding ID: doc_023\n",
113
- "Add of existing embedding ID: doc_foodpanda_plan_1\n",
114
- "Insert of existing embedding ID: doc_foodpanda_plan_1\n",
115
- "Add of existing embedding ID: doc_foodpanda_plan_2\n",
116
- "Insert of existing embedding ID: doc_foodpanda_plan_2\n",
117
- "Add of existing embedding ID: doc_foodpanda_plan_3\n",
118
- "Insert of existing embedding ID: doc_foodpanda_plan_3\n",
119
- "Add of existing embedding ID: doc_uber_plan_1\n",
120
- "Insert of existing embedding ID: doc_uber_plan_1\n",
121
- "Add of existing embedding ID: doc_uber_plan_2\n",
122
- "Insert of existing embedding ID: doc_uber_plan_2\n",
123
- "Add of existing embedding ID: doc_comparison_overall\n",
124
- "Insert of existing embedding ID: doc_comparison_overall\n",
125
- "Add of existing embedding ID: doc_introduction_scenario\n",
126
- "Insert of existing embedding ID: doc_introduction_scenario\n"
127
  ]
128
  },
129
  {
 
57
  },
58
  {
59
  "cell_type": "code",
60
+ "execution_count": 2,
61
  "metadata": {},
62
  "outputs": [
63
  {
64
  "name": "stderr",
65
  "output_type": "stream",
66
  "text": [
67
+ "You're using a XLMRobertaTokenizerFast tokenizer. Please note that with a fast tokenizer, using the `__call__` method is faster than using a method to encode the text followed by a call to the `pad` method to get a padded encoding.\n"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
68
  ]
69
  },
70
  {