forked from zhengbw0324/LC-Rec
-
Notifications
You must be signed in to change notification settings - Fork 5
/
prompt.py
executable file
·663 lines (501 loc) · 23.2 KB
/
prompt.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
sft_prompt = "Below is an instruction that describes a task. Write a response that appropriately completes the request." \
"\n\n### Instruction:\n{instruction}\n\n### Response:{response}"
all_prompt = {}
# =====================================================
# Task 1 -- Sequential Recommendation -- 17 Prompt
# =====================================================
seqrec_prompt = []
#####——0
prompt = {}
prompt["instruction"] = "The user has interacted with items {inters} in chronological order. Can you predict the next possible item that the user may expect?"
prompt["response"] = "{item}"
seqrec_prompt.append(prompt)
#####——1
prompt = {}
prompt["instruction"] = "I find the user's historical interactive items: {inters}, and I want to know what next item the user needs. Can you help me decide?"
prompt["response"] = "{item}"
seqrec_prompt.append(prompt)
#####——2
prompt = {}
prompt["instruction"] = "Here are the user's historical interactions: {inters}, try to recommend another item to the user. Note that the historical interactions are arranged in chronological order."
prompt["response"] = "{item}"
seqrec_prompt.append(prompt)
#####——3
prompt = {}
prompt["instruction"] = "Based on the items that the user has interacted with: {inters}, can you determine what item would be recommended to him next?"
prompt["response"] = "{item}"
seqrec_prompt.append(prompt)
#####——4
prompt = {}
prompt["instruction"] = "The user has interacted with the following items in order: {inters}. What else do you think the user need?"
prompt["response"] = "{item}"
seqrec_prompt.append(prompt)
#####——5
prompt = {}
prompt["instruction"] = "Here is the item interaction history of the user: {inters}, what to recommend to the user next?"
prompt["response"] = "{item}"
seqrec_prompt.append(prompt)
#####——6
prompt = {}
prompt["instruction"] = "Which item would the user be likely to interact with next after interacting with items {inters}?"
prompt["response"] = "{item}"
seqrec_prompt.append(prompt)
#####——7
prompt = {}
prompt["instruction"] = "By analyzing the user's historical interactions with items {inters}, what is the next expected interaction item?"
prompt["response"] = "{item}"
seqrec_prompt.append(prompt)
#####——8
prompt = {}
prompt["instruction"] = "After interacting with items {inters}, what is the next item that could be recommended for the user?"
prompt["response"] = "{item}"
seqrec_prompt.append(prompt)
#####——9
prompt = {}
prompt["instruction"] = "Given the user's historical interactive items arranged in chronological order: {inters}, can you recommend a suitable item for the user?"
prompt["response"] = "{item}"
seqrec_prompt.append(prompt)
#####——10
prompt = {}
prompt["instruction"] = "Considering the user has interacted with items {inters}. What is the next recommendation for the user?"
prompt["response"] = "{item}"
seqrec_prompt.append(prompt)
#####——11
prompt = {}
prompt["instruction"] = "What is the top recommended item for the user who has previously interacted with items {inters} in order?"
prompt["response"] = "{item}"
seqrec_prompt.append(prompt)
#####——12
prompt = {}
prompt["instruction"] = "The user has interacted with the following items in the past in order: {inters}. Please predict the next item that the user most desires based on the given interaction records."
prompt["response"] = "{item}"
seqrec_prompt.append(prompt)
# prompt = {}
# prompt["instruction"] = "The user has interacted with the following items in the past in order: {inters}. Please predict the next item that the user is most likely to interact with based on the given interaction record. Note that his most recently interacted item is {}."
# prompt["response"] = "{item}"
# prompt["task"] = "sequential"
# prompt["id"] = "1-13"
#
# seqrec_prompt.append(prompt)
#####——13
prompt = {}
prompt["instruction"] = "Using the user's historical interactions as input data, suggest the next item that the user is highly likely to enjoy. The historical interactions are provided as follows: {inters}."
prompt["response"] = "{item}"
seqrec_prompt.append(prompt)
#####——14
prompt = {}
prompt["instruction"] = "You can access the user's historical item interaction records: {inters}. Now your task is to recommend the next potential item to him, considering his past interactions."
prompt["response"] = "{item}"
seqrec_prompt.append(prompt)
#####——15
prompt = {}
prompt["instruction"] = "You have observed that the user has interacted with the following items: {inters}, please recommend a next item that you think would be suitable for the user."
prompt["response"] = "{item}"
seqrec_prompt.append(prompt)
#####——16
prompt = {}
prompt["instruction"] = "You have obtained the ordered list of user historical interaction items, which is as follows: {inters}. Using this history as a reference, please select the next item to recommend to the user."
prompt["response"] = "{item}"
seqrec_prompt.append(prompt)
all_prompt["seqrec"] = seqrec_prompt
# ========================================================
# Task 2 -- Item2Index -- 19 Prompt
# ========================================================
# Remove periods when inputting
item2index_prompt = []
# ========================================================
# Title2Index
#####——0
prompt = {}
prompt["instruction"] = "Which item has the title: \"{title}\"?"
prompt["response"] = "{item}"
item2index_prompt.append(prompt)
#####——1
prompt = {}
prompt["instruction"] = "Which item is assigned the title: \"{title}\"?"
prompt["response"] = "{item}"
item2index_prompt.append(prompt)
#####——2
prompt = {}
prompt["instruction"] = "An item is called \"{title}\", could you please let me know which item it is?"
prompt["response"] = "{item}"
item2index_prompt.append(prompt)
#####——3
prompt = {}
prompt["instruction"] = "Which item is called \"{title}\"?"
prompt["response"] = "{item}"
item2index_prompt.append(prompt)
#####——4
prompt = {}
prompt["instruction"] = "One of the items is named \"{title}\", can you tell me which item this is?"
prompt["response"] = "{item}"
item2index_prompt.append(prompt)
#####——5
prompt = {}
prompt["instruction"] = "What is the item that goes by the title \"{title}\"?"
prompt["response"] = "{item}"
item2index_prompt.append(prompt)
# prompt = {}
# prompt["instruction"] = "Which item is referred to as \"{title}\"?"
# prompt["response"] = "{item}"
# item2index_prompt.append(prompt)
# ========================================================
# Description2Index
#####——6
prompt = {}
prompt["instruction"] = "An item can be described as follows: \"{description}\". Which item is it describing?"
prompt["response"] = "{item}"
item2index_prompt.append(prompt)
#####——7
prompt = {}
prompt["instruction"] = "Can you tell me what item is described as \"{description}\"?"
prompt["response"] = "{item}"
item2index_prompt.append(prompt)
#####——8
prompt = {}
prompt["instruction"] = "Can you provide the item that corresponds to the following description: \"{description}\"?"
prompt["response"] = "{item}"
item2index_prompt.append(prompt)
# prompt = {}
# prompt["instruction"] = "What is the item described as follows: \"{description}\"?"
# prompt["response"] = "{item}"
# item2index_prompt.append(prompt)
#####——9
prompt = {}
prompt["instruction"] = "Which item has the following characteristics: \"{description}\"?"
prompt["response"] = "{item}"
item2index_prompt.append(prompt)
#####——10
prompt = {}
prompt["instruction"] = "Which item is characterized by the following description: \"{description}\"?"
prompt["response"] = "{item}"
item2index_prompt.append(prompt)
#####——11
prompt = {}
prompt["instruction"] = "I am curious to know which item can be described as follows: \"{description}\". Can you tell me?"
prompt["response"] = "{item}"
item2index_prompt.append(prompt)
# ========================================================
# Title and Description to index
#####——12
prompt = {}
prompt["instruction"] = "An item is called \"{title}\" and described as \"{description}\", can you tell me which item it is?"
prompt["response"] = "{item}"
item2index_prompt.append(prompt)
#####——13
prompt = {}
prompt["instruction"] = "Could you please identify what item is called \"{title}\" and described as \"{description}\"?"
prompt["response"] = "{item}"
item2index_prompt.append(prompt)
#####——14
prompt = {}
prompt["instruction"] = "Which item is called \"{title}\" and has the characteristics described below: \"{description}\"?"
prompt["response"] = "{item}"
item2index_prompt.append(prompt)
#####——15
prompt = {}
prompt["instruction"] = "Please show me which item is named \"{title}\" and its corresponding description is: \"{description}\"."
prompt["response"] = "{item}"
item2index_prompt.append(prompt)
# prompt = {}
# prompt["instruction"] = "Here is an item called \"{title}\" and described as \"{description}\". Which item is it?"
# prompt["response"] = "{item}"
# item2index_prompt.append(prompt)
#####——16
prompt = {}
prompt["instruction"] = "Determine which item this is by its title and description. The title is: \"{title}\", and the description is: \"{description}\"."
prompt["response"] = "{item}"
item2index_prompt.append(prompt)
#####——17
prompt = {}
prompt["instruction"] = "Based on the title: \"{title}\", and the description: \"{description}\", answer which item is this?"
prompt["response"] = "{item}"
item2index_prompt.append(prompt)
#####——18
prompt = {}
prompt["instruction"] = "Can you identify the item from the provided title: \"{title}\", and description: \"{description}\"?"
prompt["response"] = "{item}"
item2index_prompt.append(prompt)
all_prompt["item2index"] = item2index_prompt
# ========================================================
# Task 3 -- Index2Item --17 Prompt
# ========================================================
# Remove periods when inputting
index2item_prompt = []
# ========================================================
# Index2Title
#####——0
prompt = {}
prompt["instruction"] = "What is the title of item {item}?"
prompt["response"] = "{title}"
index2item_prompt.append(prompt)
#####——1
prompt = {}
prompt["instruction"] = "What title is assigned to item {item}?"
prompt["response"] = "{title}"
index2item_prompt.append(prompt)
#####——2
prompt = {}
prompt["instruction"] = "Could you please tell me what item {item} is called?"
prompt["response"] = "{title}"
index2item_prompt.append(prompt)
#####——3
prompt = {}
prompt["instruction"] = "Can you provide the title of item {item}?"
prompt["response"] = "{title}"
index2item_prompt.append(prompt)
#####——4
prompt = {}
prompt["instruction"] = "What item {item} is referred to as?"
prompt["response"] = "{title}"
index2item_prompt.append(prompt)
#####——5
prompt = {}
prompt["instruction"] = "Would you mind informing me about the title of item {item}?"
prompt["response"] = "{title}"
index2item_prompt.append(prompt)
# ========================================================
# Index2Description
#####——6
prompt = {}
prompt["instruction"] = "Please provide a description of item {item}."
prompt["response"] = "{description}"
index2item_prompt.append(prompt)
#####——7
prompt = {}
prompt["instruction"] = "Briefly describe item {item}."
prompt["response"] = "{description}"
index2item_prompt.append(prompt)
#####——8
prompt = {}
prompt["instruction"] = "Can you share with me the description corresponding to item {item}?"
prompt["response"] = "{description}"
index2item_prompt.append(prompt)
#####——9
prompt = {}
prompt["instruction"] = "What is the description of item {item}?"
prompt["response"] = "{description}"
index2item_prompt.append(prompt)
#####——10
prompt = {}
prompt["instruction"] = "How to describe the characteristics of item {item}?"
prompt["response"] = "{description}"
index2item_prompt.append(prompt)
#####——11
prompt = {}
prompt["instruction"] = "Could you please tell me what item {item} looks like?"
prompt["response"] = "{description}"
index2item_prompt.append(prompt)
# ========================================================
# index to Title and Description
#####——12
prompt = {}
prompt["instruction"] = "What is the title and description of item {item}?"
prompt["response"] = "{title}\n\n{description}"
index2item_prompt.append(prompt)
#####——13
prompt = {}
prompt["instruction"] = "Can you provide the corresponding title and description for item {item}?"
prompt["response"] = "{title}\n\n{description}"
index2item_prompt.append(prompt)
#####——14
prompt = {}
prompt["instruction"] = "Please tell me what item {item} is called, along with a brief description of it."
prompt["response"] = "{title}\n\n{description}"
index2item_prompt.append(prompt)
#####——15
prompt = {}
prompt["instruction"] = "Would you mind informing me about the title of the item {item} and how to describe its characteristics?"
prompt["response"] = "{title}\n\n{description}"
index2item_prompt.append(prompt)
#####——16
prompt = {}
prompt["instruction"] = "I need to know the title and description of item {item}. Could you help me with that?"
prompt["response"] = "{title}\n\n{description}"
index2item_prompt.append(prompt)
all_prompt["index2item"] = index2item_prompt
# ========================================================
# Task 4 -- FusionSequentialRec -- Prompt
# ========================================================
fusionseqrec_prompt = []
#####——0
prompt = {}
prompt["instruction"] = "The user has sequentially interacted with items {inters}. Can you recommend the next item for him? Tell me the title of the item?"
prompt["response"] = "{title}"
fusionseqrec_prompt.append(prompt)
#####——1
prompt = {}
prompt["instruction"] = "Based on the user's historical interactions: {inters}, try to predict the title of the item that the user may need next."
prompt["response"] = "{title}"
fusionseqrec_prompt.append(prompt)
#####——2
prompt = {}
prompt["instruction"] = "Utilizing the user's past ordered interactions, which include items {inters}, please recommend the next item you think is suitable for the user and provide its title."
prompt["response"] = "{title}"
fusionseqrec_prompt.append(prompt)
#####——3
prompt = {}
prompt["instruction"] = "After interacting with items {inters}, what is the most probable item for the user to interact with next? Kindly provide the item's title."
prompt["response"] = "{title}"
fusionseqrec_prompt.append(prompt)
#####——4
prompt = {}
prompt["instruction"] = "Please review the user's historical interactions: {inters}, and describe what kind of item he still needs."
prompt["response"] = "{description}"
fusionseqrec_prompt.append(prompt)
#####——5
prompt = {}
prompt["instruction"] = "Here is the item interaction history of the user: {inters}, please tell me what features he expects from his next item."
prompt["response"] = "{description}"
fusionseqrec_prompt.append(prompt)
#####——6
prompt = {}
prompt["instruction"] = "By analyzing the user's historical interactions with items {inters}, can you infer what the user's next interactive item will look like?"
prompt["response"] = "{description}"
fusionseqrec_prompt.append(prompt)
#####——7
prompt = {}
prompt["instruction"] = "Access the user's historical item interaction records: {inters}. Your objective is to describe the next potential item for him, taking into account his past interactions."
prompt["response"] = "{description}"
fusionseqrec_prompt.append(prompt)
#####——8
prompt = {}
prompt["instruction"] = "Given the title sequence of user historical interactive items: {inter_titles}, can you recommend a suitable next item for the user?"
prompt["response"] = "{item}"
fusionseqrec_prompt.append(prompt)
#####——9
prompt = {}
prompt["instruction"] = "I possess a user's past interaction history, denoted by the title sequence of interactive items: {inter_titles}, and I am interested in knowing the user's next most desired item. Can you help me?"
prompt["response"] = "{item}"
fusionseqrec_prompt.append(prompt)
#####——10
prompt = {}
prompt["instruction"] = "Considering the title sequence of user history interaction items: {inter_titles}. What is the next recommendation for the user?"
prompt["response"] = "{item}"
fusionseqrec_prompt.append(prompt)
#####——11
prompt = {}
prompt["instruction"] = "You have obtained the ordered title list of user historical interaction items, as follows: {inter_titles}. Based on this historical context, kindly choose the subsequent item for user recommendation."
prompt["response"] = "{item}"
fusionseqrec_prompt.append(prompt)
all_prompt["fusionseqrec"] = fusionseqrec_prompt
# ========================================================
# Task 5 -- ItemSearch -- Prompt
# ========================================================
itemsearch_prompt = []
#####——0
prompt = {}
prompt["instruction"] = "Here is the historical interactions of a user: {inters}. And his personalized preferences are as follows: \"{explicit_preference}\". Your task is to recommend an item that is consistent with the user's preference."
prompt["response"] = "{item}"
itemsearch_prompt.append(prompt)
#####——1
prompt = {}
prompt["instruction"] = "The user has interacted with a list of items, which are as follows: {inters}. Based on these interacted items, the user current intent is as follows \"{user_related_intention}\", and your task is to generate an item that matches the user's current intent."
prompt["response"] = "{item}"
itemsearch_prompt.append(prompt)
#####——2
prompt = {}
prompt["instruction"] = "As a recommender system, you are assisting a user who has recently interacted with the following items: {inters}. The user expresses a desire to obtain another item with the following characteristics: \"{item_related_intention}\". Please recommend an item that meets these criteria."
prompt["response"] = "{item}"
itemsearch_prompt.append(prompt)
#####——3
prompt = {}
prompt["instruction"] = "Using the user's current query: \"{query}\" and his historical interactions: {inters}, you can estimate the user's preferences \"{explicit_preference}\". Please respond to the user's query by selecting an item that best matches his preference and query."
prompt["response"] = "{item}"
itemsearch_prompt.append(prompt)
#####——4
prompt = {}
prompt["instruction"] = "The user needs a new item and searches for: \"{query}\". In addition, he has previously interacted with: {inters}. You can obtain his preference by analyzing his historical interactions: \"{explicit_preference}\". Can you recommend an item that best matches the search query and preferences?"
prompt["response"] = "{item}"
itemsearch_prompt.append(prompt)
#####——5
prompt = {}
prompt["instruction"] = "Based on the user's historical interactions with the following items: {inters}. You can infer his preference by observing the historical interactions: \"{explicit_preference}\". Now the user wants a new item and searches for: \"{query}\". Please select a suitable item that matches his preference and search intent."
prompt["response"] = "{item}"
itemsearch_prompt.append(prompt)
#####——6
prompt = {}
prompt["instruction"] = "Suppose you are a search engine, now a user searches that: \"{query}\", can you select an item to respond to the user's query?"
prompt["response"] = "{item}"
itemsearch_prompt.append(prompt)
#####——7
prompt = {}
prompt["instruction"] = "As a search engine, your task is to answer the user's query by generating a related item. The user's query is provided as \"{query}\". Please provide your generated item as your answer."
prompt["response"] = "{item}"
itemsearch_prompt.append(prompt)
#####——8
prompt = {}
prompt["instruction"] = "As a recommender system, your task is to recommend an item that is related to the user's request, which is specified as follows: \"{query}\". Please provide your recommendation."
prompt["response"] = "{item}"
itemsearch_prompt.append(prompt)
#####——9
prompt = {}
prompt["instruction"] = "You meet a user's query: \"{query}\". Please respond to this user by selecting an appropriate item."
prompt["response"] = "{item}"
itemsearch_prompt.append(prompt)
#####——10
prompt = {}
prompt["instruction"] = "Your task is to recommend the best item that matches the user's query. Here is the search query of the user: \"{query}\", tell me the item you recommend."
prompt["response"] = "{item}"
itemsearch_prompt.append(prompt)
all_prompt["itemsearch"] = itemsearch_prompt
# ========================================================
# Task 6 -- PreferenceObtain -- Prompt
# ========================================================
preferenceobtain_prompt = []
#####——0
prompt = {}
prompt["instruction"] = "The user has interacted with items {inters} in chronological order. Please estimate his preferences."
prompt["response"] = "{explicit_preference}"
preferenceobtain_prompt.append(prompt)
#####——1
prompt = {}
prompt["instruction"] = "Based on the items that the user has interacted with: {inters}, can you infer what preferences he has?"
prompt["response"] = "{explicit_preference}"
preferenceobtain_prompt.append(prompt)
#####——3
prompt = {}
prompt["instruction"] = "Can you provide a summary of the user's preferences based on his historical interactions: {inters}?"
prompt["response"] = "{explicit_preference}"
preferenceobtain_prompt.append(prompt)
#####——4
prompt = {}
prompt["instruction"] = "After interacting with items {inters} in order, what preferences do you think the user has?"
prompt["response"] = "{explicit_preference}"
preferenceobtain_prompt.append(prompt)
#####——5
prompt = {}
prompt["instruction"] = "Here is the item interaction history of the user: {inters}, could you please infer the user's preferences."
prompt["response"] = "{explicit_preference}"
preferenceobtain_prompt.append(prompt)
#####——6
prompt = {}
prompt["instruction"] = "Based on the user's historical interaction records: {inters}, what are your speculations about his preferences?"
prompt["response"] = "{explicit_preference}"
preferenceobtain_prompt.append(prompt)
#####——7
prompt = {}
prompt["instruction"] = "Given the user's historical interactive items arranged in chronological order: {inters}, what can be inferred about the preferences of the user?"
prompt["response"] = "{explicit_preference}"
preferenceobtain_prompt.append(prompt)
#####——8
prompt = {}
prompt["instruction"] = "Can you speculate on the user's preferences based on his historical item interaction records: {inters}?"
prompt["response"] = "{explicit_preference}"
preferenceobtain_prompt.append(prompt)
#####——9
prompt = {}
prompt["instruction"] = "What is the preferences of a user who has previously interacted with items {inters} sequentially?"
prompt["response"] = "{explicit_preference}"
preferenceobtain_prompt.append(prompt)
#####——10
prompt = {}
prompt["instruction"] = "Using the user's historical interactions as input data, summarize the user's preferences. The historical interactions are provided as follows: {inters}."
prompt["response"] = "{explicit_preference}"
preferenceobtain_prompt.append(prompt)
#####——11
prompt = {}
prompt["instruction"] = "Utilizing the ordered list of the user's historical interaction items as a reference, please make an informed estimation of the user's preferences. The historical interactions are as follows: {inters}."
prompt["response"] = "{explicit_preference}"
preferenceobtain_prompt.append(prompt)
all_prompt["preferenceobtain"] = preferenceobtain_prompt