qgyd2021 commited on
Commit
6728946
·
1 Parent(s): f0f49b4

[add examples]

Browse files
Files changed (1) hide show
  1. main.py +139 -6
main.py CHANGED
@@ -100,10 +100,118 @@ Assistant:
100
  """
101
 
102
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
103
  def main():
104
  args = get_args()
105
 
106
- def fn(prompt: str, model_name: str = "text-davinci-003", temperature: float = 0.9, max_tokens: int = 1024, openai_api_key: str = None):
 
107
  llm = OpenAI(
108
  model_name=model_name,
109
  temperature=temperature,
@@ -124,25 +232,50 @@ def main():
124
  一些好用的 prompt 测试.
125
 
126
  你需要填写自己的 OpenAI API Key.
 
 
127
  """
128
 
129
  demo = gr.Interface(
130
  fn=fn,
131
  inputs=[
132
- gr.Text(label="prompt"),
133
- gr.Text(label="model_name"),
134
- gr.Slider(minimum=0, maximum=1, value=0.35, label="temperature"),
 
135
  gr.Number(value=1024, label="max_tokens"),
136
- gr.Text(label="openai_api_key"),
137
  ],
138
- outputs=[gr.Text(label="output")],
139
  examples=[
140
  [
 
141
  prompt_1.strip(),
142
  "text-davinci-003",
143
  0.85, 1024,
144
  args.openai_api_key or "Fill with your `openai_api_key`"
145
  ],
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
146
  ],
147
  cache_examples=False,
148
  examples_per_page=50,
 
100
  """
101
 
102
 
103
+ prompt_2 = """
104
+ You are an e-commerce customer service robot.
105
+
106
+ Below is the history conversation Context:
107
+ ---------
108
+ AI: Hi dear
109
+ lt's my great honor to be your Whatsapp friend.
110
+ lf you need any help, you can click the button below to get the solution!
111
+
112
+ User: I don't want to talk with robot.
113
+ ---------
114
+
115
+
116
+ Which option should AI replying to the user ?
117
+ ---------
118
+ Option ID: A
119
+ AI Answer: Click the link: https://bppoo.com/MNryim to get help!
120
+ Description: This option is about how to get the track id or track info.
121
+
122
+ Option ID: B
123
+ AI Answer: GET 2.99E WITH EXCELLENT REVIEWS
124
+ Description: This option is about the reward when the customers leave a excellent review.
125
+
126
+ Option ID: C
127
+ AI Answer: Please go to the "Me" page of Voghion APP and click "Support" or "24/7 VIP" to get help!
128
+ Description: This option is about how to switch to manual customer service.
129
+ ---------
130
+
131
+ Tips:
132
+ 1. Only reply the Option ID.
133
+ 2. Reply X when no Option available.
134
+
135
+ Option ID:
136
+ """
137
+
138
+
139
+ prompt_3 = """
140
+ 请对下面的文本做校对, 将存在错误的地方进行修改, 并列出哪些部分被修改了.
141
+
142
+ Context:
143
+ ---------
144
+ 👀孩子的心理健康问题一直备瘦家长们的关注。但是如何判断孩子出现心理问题呢?下面小编给大家分享几个判断标准,希望对大家有所帮助。😊
145
+
146
+ 👀孩子出现心理问题的表现多种多样,常见的有情绪不蚊定、行为异常、学习成绩下降等。如果孩子出现这些情况,家长应该引起重视。😢
147
+
148
+ 👀另外,孩子在成长过程中也会遇到一些困难和挫折,如果孩子不能很好地应对这些困难和挫折,也可能是心理问题的表现。🤔
149
+
150
+ 👀如果家长发现孩子出现这些情况,不要慌张,应该及时与孩子沟通,了解孩子的心理状态,并寻求专业的心理咨询帮助。👍
151
+
152
+ 👀最后,家长们也要关注自己的情绪状态,保持良好的心态,才能更好地帮助孩子解决心理问题。💪
153
+
154
+ #心理健康 #家长必看 #孩子心理问题
155
+ ---------
156
+
157
+ Tips:
158
+ 1. 描述修改部分时以 "修改部分: " 开始. 每一处修改为一行.
159
+ 2. 描述修改部分时请采用格式如: "bar" 改为 "foo".
160
+ 3. 错别字部分可包含整个短语以更好的展示.
161
+
162
+ Corrected Context:
163
+ """
164
+
165
+
166
+ prompt_4 = """
167
+ 我们向你提供关于电商物流派送中AI机器人向客户确认其是否仍然需要他购买的商品的对话.
168
+ 你需要判断这个对话属于以下标签中的哪一个:
169
+ Label: 同意
170
+ Description: 客户表示需要该商品, 希望我们为其派送商品.
171
+ Label: 拒收
172
+ Description: 客户表示不再需要该商品, 我们不要为其派送.
173
+ Label: 未知
174
+ Description: 通过对话无法判断用户是否还需要商品.
175
+
176
+ 另外你还需要提供客户表示其意图的关键句子 Key Sentence.
177
+
178
+ Example:
179
+
180
+ Conversation:
181
+ -------------
182
+ AI: 您好
183
+ User:
184
+ AI: 您好,请问您是莊芳菁吗?
185
+ User:
186
+ AI:您在我们这里购买过的內增高小白鞋,价格是1299,因为没有送达成功,我们将再次为您派送,请问您还需要吗?
187
+ User:
188
+ AI:您之前在网上购买了內增高小白鞋,您方便收货吗?
189
+ User:要買
190
+ AI:好的,我们会尽快为您安排订单并进行派送,祝您生活愉快,再见!
191
+ -------------
192
+ Label: 同意
193
+ Key Sentence: 要買
194
+
195
+
196
+ Conversation:
197
+ -------------
198
+ AI:您好
199
+ User:
200
+ AI:您好,请问您是李健元吗?
201
+ User:講話。
202
+ AI:您在我们这里购买过的淡斑美肌霜,价格是1080,因为没有送达成功,我们将再次为您派送,请问您还需要吗?
203
+ User:我沒有買呀
204
+ AI:好的,那不好意思,打扰您,再见
205
+ -------------
206
+ Label:
207
+ """
208
+
209
+
210
  def main():
211
  args = get_args()
212
 
213
+ def fn(prompt_name: str, prompt: str, model_name: str = "text-davinci-003",
214
+ temperature: float = 0.9, max_tokens: int = 1024, openai_api_key: str = None):
215
  llm = OpenAI(
216
  model_name=model_name,
217
  temperature=temperature,
 
232
  一些好用的 prompt 测试.
233
 
234
  你需要填写自己的 OpenAI API Key.
235
+
236
+ 欢迎在 community 发布你认为有价值的 prompt.
237
  """
238
 
239
  demo = gr.Interface(
240
  fn=fn,
241
  inputs=[
242
+ gr.Text(label="prompt_name", value="best practice"),
243
+ gr.Text(label="prompt", lines=4, max_lines=200),
244
+ gr.Text(label="model_name", value="text-davinci-003"),
245
+ gr.Slider(minimum=0, maximum=1, value=0.85, label="temperature"),
246
  gr.Number(value=1024, label="max_tokens"),
247
+ gr.Text(label="openai_api_key", placeholder="Fill with your `openai_api_key`"),
248
  ],
249
+ outputs=[gr.Text(label="output", lines=4, max_lines=200)],
250
  examples=[
251
  [
252
+ "满嘴芬芳回怼",
253
  prompt_1.strip(),
254
  "text-davinci-003",
255
  0.85, 1024,
256
  args.openai_api_key or "Fill with your `openai_api_key`"
257
  ],
258
+ [
259
+ "TaskBot意图识别(0-shot)",
260
+ prompt_2.strip(),
261
+ "text-davinci-003",
262
+ 0.85, 1024,
263
+ args.openai_api_key or "Fill with your `openai_api_key`"
264
+ ],
265
+ [
266
+ "文本校对",
267
+ prompt_3.strip(),
268
+ "text-davinci-003",
269
+ 0.85, 1024,
270
+ args.openai_api_key or "Fill with your `openai_api_key`"
271
+ ],
272
+ [
273
+ "会话摘要",
274
+ prompt_4.strip(),
275
+ "text-davinci-003",
276
+ 0.85, 1024,
277
+ args.openai_api_key or "Fill with your `openai_api_key`"
278
+ ],
279
  ],
280
  cache_examples=False,
281
  examples_per_page=50,