faldeus0092 commited on
Commit
4b22764
1 Parent(s): d5b718d

perfection is perfected

Browse files
Files changed (3) hide show
  1. app.py +53 -19
  2. intents.py +38 -2
  3. prompt.py +14 -0
app.py CHANGED
@@ -1,21 +1,28 @@
1
  #@title Model Loading
2
  from sentence_transformers import SentenceTransformer, util
3
- from utils import get_latest_user_input_from_prompt, get_top_intents, create_embedding
4
- from intents import intents, intents_sentence_similarity_en
 
5
  import flows
 
6
  import gradio as gr
7
  import pandas as pd
 
 
 
8
 
9
  model_en = SentenceTransformer("intfloat/multilingual-e5-base")
10
  intents_embedding = create_embedding(intents_sentence_similarity_en, model_en)
11
 
 
 
12
 
13
  def raw_inference(input, state, n_samples, threshold):
14
  state = flows.STATE_FLOWS_MAP[state]
15
  query_embedding = model_en.encode(input)
16
  similarity = util.pytorch_cos_sim(query_embedding, intents_embedding)
17
  result = get_top_intents(intents, similarity, n=n_samples, threshold=threshold, flow=state)
18
- return result
19
 
20
  def process_csv(files):
21
  global df
@@ -28,28 +35,34 @@ def process_csv(files):
28
  df_length = len(df.index)
29
 
30
  chat = get_latest_user_input_from_prompt(df.iloc[1]["prompt"])
 
31
  state = flows.STATE_FLOWS_MAP[df.iloc[1]['state']]
32
  label = df.iloc[1]['chatbot_response']
33
 
34
- accuracy = gr.Markdown("""
35
 
36
- You can also check accuracy on how well the model predict the intents based on your provided CSV files. This might take 1-2 minutes.
37
 
38
- """, visible=True)
39
- accuracy_button = gr.Button("Calculate Accuracy", visible=True)
40
 
41
  return (gr.UploadButton("Upload CSV...", file_types=["file"], file_count="single", visible=False),
42
  files,
43
  gr.Slider(1, df_length, value=1, step=1, visible=True, label="Index", info="Select which index of data to check the intents"),
44
  gr.Textbox(label="Input Chat", info="Input in index", visible=True, value=chat, interactive=False),
45
  gr.Textbox(label="State", info="State on which the chat currently on. Some state will exclude some intents", visible=True, value=state, interactive=False),
46
- gr.Textbox(label="Ground Truth", info="The label in which the IntentClassification predict in the CSV", visible=True, value=label, interactive=False))
 
47
 
48
  def update_index(index):
49
  chat = get_latest_user_input_from_prompt(df.iloc[int(index)]["prompt"])
 
50
  state = df.iloc[int(index)]['state']
51
  label = df.iloc[int(index)]['chatbot_response']
52
- return gr.Textbox(label="Input Chat", info="Input in index", visible=True, value=chat, interactive=False), gr.Textbox(label="State", info="State on which the chat currently on. Some state will exclude some intents", visible=True, value=state, interactive=False), gr.Textbox(label="Ground Truth", info="The label in which the IntentClassification predict in the CSV", visible=True, value=label, interactive=False)
 
 
 
53
 
54
  def check_accuracy(n_samples, threshold):
55
  global df
@@ -82,6 +95,19 @@ def check_accuracy(n_samples, threshold):
82
  print(score, grouped_data)
83
  return score, grouped_data
84
 
 
 
 
 
 
 
 
 
 
 
 
 
 
85
  theme = gr.themes.Default(
86
  primary_hue="indigo",
87
  secondary_hue="pink",
@@ -90,8 +116,12 @@ theme = gr.themes.Default(
90
 
91
  with gr.Blocks(title="Intent Classification Demo", theme=theme) as interface:
92
  gr.Markdown("""# Demo for Intent Classification""")
 
93
  with gr.Row(equal_height=True):
94
  with gr.Column():
 
 
 
95
  with gr.Tab("Input from raw text"):
96
  raw_input_text = gr.Textbox(label="Input Chat", info="Input your chat here, the model will predict the intent")
97
  raw_state = gr.Dropdown(["GeneralState",
@@ -103,7 +133,9 @@ with gr.Blocks(title="Intent Classification Demo", theme=theme) as interface:
103
  "AssessKnowledgeState"],
104
  label="State",
105
  info="Select state on which the chat currently on. Some state will exclude some intents")
 
106
  raw_ask_button = gr.Button("Ask")
 
107
 
108
  with gr.Tab("Input from Big Query data"):
109
  gr.Markdown("""
@@ -129,12 +161,14 @@ with gr.Blocks(title="Intent Classification Demo", theme=theme) as interface:
129
  index = gr.Slider(1, 1000, value=5, step=1, visible=False, label="Index", info="Select which index of data to check the intents")
130
  input_text = gr.Textbox(label="Input Chat", info="Input in index", visible=False)
131
  state = gr.Textbox(label="State", info="State on which the chat currently on. Some state will exclude some intents", visible=False)
 
132
  gt = gr.Textbox(label="Ground Truth", info="The label in which the IntentClassification predict in the CSV", visible=False)
133
  ask_button = gr.Button("Ask With CSV")
 
134
 
135
 
136
- index.change(fn=update_index, inputs=index, outputs=[input_text, state, gt])
137
- upload_button.upload(process_csv, upload_button, [upload_button, file_output, index, input_text, state, gt])
138
  with gr.Column():
139
  with gr.Row():
140
  accuracy = gr.Markdown("""
@@ -143,18 +177,18 @@ with gr.Blocks(title="Intent Classification Demo", theme=theme) as interface:
143
 
144
  """, visible=True)
145
  accuracy_button = gr.Button("Calculate Accuracy", visible=True)
146
- accuracy_score = gr.Textbox(label="Accuracy", info="Accuracy result tested on CSV file you uploaded", visible=True)
147
  accuracy_table = gr.Dataframe(visible=True)
148
 
149
  with gr.Column():
150
- n_samples = gr.Slider(1, 10, value=5, step=1, label="N samples", info="Number of samples to be retrieved. Default is 5")
151
- threshold = gr.Slider(0.0, 1.0, value=0.75, step=0.01, label="Threshold", info="Threshold of cosine similarity which intent will be considered similar to the input. The higher, the more similar the intent will be. Default is 0.75")
152
- answer = gr.JSON(label="Prediction", show_label=True)
153
-
154
 
155
  accuracy_button.click(fn=check_accuracy, inputs=[n_samples, threshold], outputs=[accuracy_score, accuracy_table])
156
- raw_ask_button.click(fn=raw_inference, inputs=[raw_input_text, raw_state, n_samples, threshold], outputs=answer)
157
- ask_button.click(fn=raw_inference, inputs=[input_text, state, n_samples, threshold], outputs=answer)
158
-
 
159
 
160
  interface.launch(debug=True)
 
1
  #@title Model Loading
2
  from sentence_transformers import SentenceTransformer, util
3
+ from utils import get_history_from_prompt, get_latest_user_input_from_prompt, get_top_intents, create_embedding
4
+ from intents import intents, intents_sentence_similarity_en, chatbot_intents
5
+ from prompt import prompt_template
6
  import flows
7
+ import os
8
  import gradio as gr
9
  import pandas as pd
10
+ import langchain
11
+ from langchain import PromptTemplate, LLMChain
12
+ from langchain.chat_models import ChatOpenAI
13
 
14
  model_en = SentenceTransformer("intfloat/multilingual-e5-base")
15
  intents_embedding = create_embedding(intents_sentence_similarity_en, model_en)
16
 
17
+ llm = None
18
+ llm_chain = None
19
 
20
  def raw_inference(input, state, n_samples, threshold):
21
  state = flows.STATE_FLOWS_MAP[state]
22
  query_embedding = model_en.encode(input)
23
  similarity = util.pytorch_cos_sim(query_embedding, intents_embedding)
24
  result = get_top_intents(intents, similarity, n=n_samples, threshold=threshold, flow=state)
25
+ return result, gr.Button("Ask intent with Language Model", visible=True)
26
 
27
  def process_csv(files):
28
  global df
 
35
  df_length = len(df.index)
36
 
37
  chat = get_latest_user_input_from_prompt(df.iloc[1]["prompt"])
38
+ history = get_history_from_prompt(df.iloc[1]["prompt"])
39
  state = flows.STATE_FLOWS_MAP[df.iloc[1]['state']]
40
  label = df.iloc[1]['chatbot_response']
41
 
42
+ # accuracy = gr.Markdown("""
43
 
44
+ # You can also check accuracy on how well the model predict the intents based on your provided CSV files. This might take 1-2 minutes.
45
 
46
+ # """, visible=True)
47
+ # accuracy_button = gr.Button("Calculate Accuracy", visible=True)
48
 
49
  return (gr.UploadButton("Upload CSV...", file_types=["file"], file_count="single", visible=False),
50
  files,
51
  gr.Slider(1, df_length, value=1, step=1, visible=True, label="Index", info="Select which index of data to check the intents"),
52
  gr.Textbox(label="Input Chat", info="Input in index", visible=True, value=chat, interactive=False),
53
  gr.Textbox(label="State", info="State on which the chat currently on. Some state will exclude some intents", visible=True, value=state, interactive=False),
54
+ gr.Textbox(label="Ground Truth", info="The label in which the IntentClassification predict in the CSV", visible=True, value=label, interactive=False),
55
+ gr.Textbox(label="History or summary", info="Chat history or summary, if available", visible=True, value=history, interactive=False))
56
 
57
  def update_index(index):
58
  chat = get_latest_user_input_from_prompt(df.iloc[int(index)]["prompt"])
59
+ history = get_history_from_prompt(df.iloc[int(index)]["prompt"])
60
  state = df.iloc[int(index)]['state']
61
  label = df.iloc[int(index)]['chatbot_response']
62
+ return (gr.Textbox(label="Input Chat", info="Input in index", visible=True, value=chat, interactive=False),
63
+ gr.Textbox(label="State", info="State on which the chat currently on. Some state will exclude some intents", visible=True, value=state, interactive=False),
64
+ gr.Textbox(label="Ground Truth", info="The label in which the IntentClassification predict in the CSV", visible=True, value=label, interactive=False),
65
+ gr.Textbox(label="History or summary", info="Chat history or summary, if available", visible=True, value=history, interactive=False))
66
 
67
  def check_accuracy(n_samples, threshold):
68
  global df
 
95
  print(score, grouped_data)
96
  return score, grouped_data
97
 
98
+ def classify_intent(input_text:str, history:str, answer, api_key):
99
+ os.environ['OPENAI_API_KEY'] = api_key
100
+ llm = ChatOpenAI(model='gpt-3.5-turbo', temperature='0.1')
101
+ prompt = PromptTemplate(template=prompt_template, input_variables=["intents", "INPUT", "chatHistory"])
102
+ llm_chain = LLMChain(prompt=prompt, llm=llm, verbose=False)
103
+
104
+ inp_intents = ''
105
+ for i in range(len(answer)):
106
+ inp_intents += answer[i][0]+": "+chatbot_intents[answer[i][0]]+"\n"
107
+ predicted_intent = llm_chain.run({"intents":inp_intents, "INPUT": input_text, "chatHistory": history})
108
+ prompt_result = llm_chain.prompt.format_prompt(intents = inp_intents, INPUT = input_text, chatHistory = history).to_string()
109
+ return predicted_intent, prompt_result
110
+
111
  theme = gr.themes.Default(
112
  primary_hue="indigo",
113
  secondary_hue="pink",
 
116
 
117
  with gr.Blocks(title="Intent Classification Demo", theme=theme) as interface:
118
  gr.Markdown("""# Demo for Intent Classification""")
119
+
120
  with gr.Row(equal_height=True):
121
  with gr.Column():
122
+ api_key = gr.Textbox(label="OpenAI API Key", info="get it at https://platform.openai.com/account/api-keys",visible=True, lines=1, type="password")
123
+ n_samples = gr.Slider(1, 10, value=5, step=1, label="N samples", info="Number of samples to be retrieved. Default is 5")
124
+ threshold = gr.Slider(0.0, 1.0, value=0.75, step=0.01, label="Threshold", info="Threshold of cosine similarity which intent will be considered similar to the input. The higher, the more similar the intent will be. Default is 0.75")
125
  with gr.Tab("Input from raw text"):
126
  raw_input_text = gr.Textbox(label="Input Chat", info="Input your chat here, the model will predict the intent")
127
  raw_state = gr.Dropdown(["GeneralState",
 
133
  "AssessKnowledgeState"],
134
  label="State",
135
  info="Select state on which the chat currently on. Some state will exclude some intents")
136
+ raw_history = gr.Textbox(label="History or summary", info="Chat history or summary, if available", visible=True)
137
  raw_ask_button = gr.Button("Ask")
138
+ ask_llm_button_raw = gr.Button("Ask intent with Language Model", visible=False)
139
 
140
  with gr.Tab("Input from Big Query data"):
141
  gr.Markdown("""
 
161
  index = gr.Slider(1, 1000, value=5, step=1, visible=False, label="Index", info="Select which index of data to check the intents")
162
  input_text = gr.Textbox(label="Input Chat", info="Input in index", visible=False)
163
  state = gr.Textbox(label="State", info="State on which the chat currently on. Some state will exclude some intents", visible=False)
164
+ history = gr.Textbox(label="History or summary", info="Chat history or summary, if available", visible=False)
165
  gt = gr.Textbox(label="Ground Truth", info="The label in which the IntentClassification predict in the CSV", visible=False)
166
  ask_button = gr.Button("Ask With CSV")
167
+ ask_llm_button = gr.Button("Ask intent with Language Model", visible=False)
168
 
169
 
170
+ index.change(fn=update_index, inputs=index, outputs=[input_text, state, gt, history])
171
+ upload_button.upload(process_csv, upload_button, [upload_button, file_output, index, input_text, state, gt, history])
172
  with gr.Column():
173
  with gr.Row():
174
  accuracy = gr.Markdown("""
 
177
 
178
  """, visible=True)
179
  accuracy_button = gr.Button("Calculate Accuracy", visible=True)
180
+ accuracy_score = gr.Label(label="Accuracy result", visible=True)
181
  accuracy_table = gr.Dataframe(visible=True)
182
 
183
  with gr.Column():
184
+ answer = gr.JSON(label="Sentence Similarity Prediction", show_label=True)
185
+ LLM_prediction = gr.Label(label="LLM Prediction Result", visible=True)
186
+ LLM_prompt = gr.Textbox(label="Prompt Used for Language Model", info="Showing prompt used in language model", visible=True)
 
187
 
188
  accuracy_button.click(fn=check_accuracy, inputs=[n_samples, threshold], outputs=[accuracy_score, accuracy_table])
189
+ raw_ask_button.click(fn=raw_inference, inputs=[raw_input_text, raw_state, n_samples, threshold], outputs=[answer, ask_llm_button_raw])
190
+ ask_button.click(fn=raw_inference, inputs=[input_text, state, n_samples, threshold], outputs=[answer, ask_llm_button])
191
+ ask_llm_button.click(fn=classify_intent, inputs=[input_text, history, answer, api_key], outputs=[LLM_prediction, LLM_prompt])
192
+ ask_llm_button_raw.click(fn=classify_intent, inputs=[raw_input_text, raw_history, answer, api_key], outputs=[LLM_prediction, LLM_prompt])
193
 
194
  interface.launch(debug=True)
intents.py CHANGED
@@ -21,11 +21,11 @@ intents_sentence_similarity_en = {
21
  "exercise_multiple_question":"Wants to do exercise with a number of question",
22
  "exercise_multiple_question_with_topic":"Wants to do exercise with a number of question with topics",
23
  "personal":"Sharing personal story (aku mau curhat, kak lagi sedih)",
24
- "general_intent":"Greetings, Asking/desire about study and exams in general. (aku pusing, aku mau belajar kak, besok ulangan, butuh temen belajar, besok ujian, temenin aku, bantu aku, aku butuh bantuan)",
25
  "provide_topic":"Lesson material Topic",
26
  "provide_subject":"Lesson material Subject (Fisika, Kimia, Matematika, Biologi, Sejarah, Bahasa Indonesia, Geografi, Biologi, Bahasa Inggris)",
27
  "provide_subtopic":"Lesson material Subtopic",
28
- "provide_concept":"Concept",
29
  "finish_learning":"Finished/already learned (Terimakasih /Thank you/No/Sudah paham!/Ok/Tidak)",
30
  "back_to_study":"Return to study (Kembali Belajar) /Mulai Belajar?/langsung mulai belajar",
31
  "similar_question":"Create similar exercise questions (Buatkan Soal Serupa / Cari Soal Serupa / Soal lagi yang mirip / Latihan soal yang mirip)",
@@ -66,3 +66,39 @@ intents = ['homework',
66
  'provide_answer',
67
  'diagnosis_result',
68
  'explain_drill']
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
21
  "exercise_multiple_question":"Wants to do exercise with a number of question",
22
  "exercise_multiple_question_with_topic":"Wants to do exercise with a number of question with topics",
23
  "personal":"Sharing personal story (aku mau curhat, kak lagi sedih)",
24
+ "general_intent":" casual chatting, Greetings (halo kak, selamat pagi), Asking help about study and exams in general (aku pusing, aku stres, aku mau belajar kak, besok ulangan, butuh temen belajar, besok ujian, temenin aku, bantu aku, aku butuh bantuan)",
25
  "provide_topic":"Lesson material Topic",
26
  "provide_subject":"Lesson material Subject (Fisika, Kimia, Matematika, Biologi, Sejarah, Bahasa Indonesia, Geografi, Biologi, Bahasa Inggris)",
27
  "provide_subtopic":"Lesson material Subtopic",
28
+ "provide_concept":"Explain concept",
29
  "finish_learning":"Finished/already learned (Terimakasih /Thank you/No/Sudah paham!/Ok/Tidak)",
30
  "back_to_study":"Return to study (Kembali Belajar) /Mulai Belajar?/langsung mulai belajar",
31
  "similar_question":"Create similar exercise questions (Buatkan Soal Serupa / Cari Soal Serupa / Soal lagi yang mirip / Latihan soal yang mirip)",
 
66
  'provide_answer',
67
  'diagnosis_result',
68
  'explain_drill']
69
+
70
+ chatbot_intents = {
71
+ "homework":"The student needs help to do their homework (PR). The student doesn't provide the question, only the intention. (Bantu Kerjakan PR, Bantu PR,tanya soal, tanya pr, tanya soal lain, tanya soal yang lain, tanya yang lain",
72
+ "homework_with_question":"Help students with their homework (PR), the student provide the specific question about their homework. ('berapa 1+1 ?', 'berapa kecepatan mobil yang menempuh jarak 100km dalam waktu 2 jam ?', 'apa yang dimaksud dengan monokotil dan dikotil ?')",
73
+ "explain_answer":"Student is curious or wants more explanation about the answer (Belajar Lebih Dalam/Ceritakan lebih lanjut/jelaskan dari awal/jelaskan/jelasin lebih lanjut/belum paham)",
74
+ "explain_answer_with_topic":"Student is curious or wants more explanation about specific topics (Belajar Lebih Dalam terkait termodinamika/Ceritakan lebih lanjut bab matematika integral/jelaskan dari awal materi mitosis/jelaskan lebih lanjut pelajaran listrik/belum paham terkait materi past tenses)",
75
+ "core_explanation_repeat":"Student wants repeat explanation (Jelasin ulang/Jelaskan ulang/Jelaskan lagi)",
76
+ "core_explanation_exercise":"Student wants explain with exercise (Contoh Soal/Contoh soal dong/bahas dengan soal)",
77
+ "core_explanation_video":"Student wants explanation with video (Video Penjelasan/Bahas dengan video/mau video penjelasan)",
78
+ "core_explanation_protips":"Student wants tips and tricks (protips/tips dan trik)",
79
+ "negative_respond":"Student respond they dont understand the explanation (aku belum paham, masih belum paham, aku gangerti, aku belum mengerti, masih bingung)",
80
+ "positive_respond":"Student respond they understand the explanation (aku sudah paham, oke paham kak, oke mengerti, oke aman, lanjut kak)",
81
+ "recommend":"The student want learning materials suggestions (Rekomendasi Materi/Suggested Materials/Materi Terkait)",
82
+ "recommend_with_topic":"The student want learning materials suggestions, students provide the topic (Aku mau materi integral/lagi pengen materi aritmatika/mau materi kimia dong kak/Rekomendasi materi tata surya kak/Materi terkait termodinamika)",
83
+ "assess_knowledge":"The student want their skill/knowledge to be assessed (Cek Kemampuan/Uji kemampuan/diagnosis kemampuan/mengasah kemampuan/Belajar Lebih Efektif/Cek pemahamanku)",
84
+ "assess_knowledge_with_topic":"The student want their skill/knowledge to be assessed and student provide topics(Cek Kemampuan integral/Uji kemampuan tata surya/diagnosis kemampuan termodinamika/mengasah kemampuan hukum newton/Cek pemahaman aljabar linear)",
85
+ "assess_knowledge_answer":"The student answer to follow up Diagnosis Kemampuan result. (jawabanku kok salah ya, kenapa bisa salah ya jawabanku, aku gabisa jawab, wah jawabanku bener wkwk, yeay bener semua jawabanku, jawabanku salah 1 aja yeay, cuman bener 1 jawabanku, secara garis besar udah bagus ya hasilku, perlu peningkatan belajar lagi nih)",
86
+ "exercise":"The student want to do exercise (Latihan Soal, aku mau soal, aku butuh soal, bantu carikan soal dong, mau soal dong, mau pertanyaan dong, latihan pertanyaan, coba ulang pertanyaan nya, ulangi pertanyaanya karena tadi kurang jelas, minta soal)",
87
+ "exercise_with_image":"The student want to do exercise with an image (aku mau soal dengan gambar, aku butuh soal pake gambar, bantu carikan soal menggunakan gambar dong, mau soal pake gambar, minta soal yang ada gambarnya)",
88
+ "exercise_with_topic":"The student want to do exercise and students provide topic (carikan soal integral, mau soal fisika, berikan aku soal tata surya, soal geografi, latihan soal ekonomi, soal biologi)",
89
+ "exercise_multiple_question":"The student wants exercise with multiple / more than one question without topics (langsung 2 soal dong, mau 10 soal sekaligus, berikan aku 4 soal)",
90
+ "exercise_multiple_question_with_topic":"The student wants exercise with multiple / more than one question with topics (minta soal 2 fotosintesis kak, mau 10 soal sekaligus aritmatika, berikan aku 4 soal termodinamika fisika)",
91
+ "personal":"The student want to share their personal story (aku mau curhat, kak lagi sedih)",
92
+ "general_intent":"The student intent in general about study. (aku pusing, aku mau belajar kak, besok ulangan, butuh temen belajar, besok ujian, temenin aku, bantu aku, aku butuh bantuan)",
93
+ "provide_topic":"The student provide topics. the topic is more specific hierarchy rather than subject example topic is integral, stoikiometri, termodinamika, mitosis. Usually only one words",
94
+ "provide_subject":"The student provide subjects. example subjects are matematika, fisika, kimia, biologi, sejarah, geografi, fisika. Usually only one words",
95
+ "provide_subtopic":"The student provide subtopic. subtopic is more specific compared to subjects and topics. for example subjects: fisika, topics: energi, subtopics: energi termal. for example subtopics: energi kinetik, aljabar linear, fungsi trigonometri. Usually more than one words",
96
+ "provide_concept":"The student provide concept. concept is more specific compared to subjects, topics, and subtopics. for example subjects: fisika, topics: energi, subtopics: energi termal, concept: mengerti suhu dan kesetimbangan termal. for example concepts: sistem persamaan linear dua variabel, prinsip kekekalan energi termal, hukum termodinamika pertama. Usually more than one words",
97
+ "finish_learning":"Students feel that they have enough/finish about the learning they are doing.",
98
+ "back_to_study":"students wants to back study (Kembali Belajar)",
99
+ "similar_question":"students wants to create variations of questions (Buatkan Soal Serupa / Cari Soal Serupa / Soal lagi yang mirip / Latihan soal yang mirip)",
100
+ "provide_answer":"students answer the questions from chatbot multiple questions. Sometimes students only answer with 1 characters like (A, B, C, D) or more than one characters (Jawabanya B, B. tata surya, D.trigonometri, Menurutku jawabanya C)",
101
+ "diagnosis_result":"students want to see their diagnosis result (Lihat hasil diagnosis / hasil drill)",
102
+ "explain_drill":"students want to know more about the drill material topics/subtopics (bahas lewat chat/bahas soal nomer 1 ya/bahas soal nomer 2 ya/bahas soal nomer 3 ya/bahas soal nomer 4 ya/bahas soal nomer 5 ya)"
103
+ }
104
+
prompt.py ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #@title prompt.py
2
+ prompt_template = """
3
+ You are to classify the following message into exactly one of the intents described below:
4
+
5
+ {intents}
6
+ unknown: You don't find the matching intent from the above list
7
+
8
+ Message: {INPUT}
9
+
10
+ Here are previous chats or summary conversation for your reference (only use this if you need further information to infer the intent):
11
+ {chatHistory}
12
+
13
+ Intent:
14
+ """