File size: 868 Bytes
908351f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
"""
Generate a prompt for generating the title of a paper based on its abstract.

Args:
    usr_input (str): A string containing the title and abstract of the paper in the format "Title: <title> Abstract: <abstract>".
    template (dict): A dictionary containing the template for the prompt with a key "prompt_input".

Returns:
    str: A formatted string with the instruction and abstract to be used as input for generating the title.
"""

def abs_2_title(usr_input, template, has_predefined_template=False):
    instruction = "Please generate the title of paper based on its abstract"

    if has_predefined_template:
        res = [
            {"role": "system", "content": instruction},
            {"role": "user", "content": usr_input},
        ]
    else:
        res = template["prompt_input"].format(instruction=instruction, input=usr_input)

    return res