File size: 3,041 Bytes
63fba53
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
def get_multiple_choice_prompt(question,choices,is_reasoning = False,lang = "en"):
    choices = [str(choice) for choice in choices]
    options = "\n".join(choices)

    if lang == "en":
        prompt = f"""
Question: {question}
Options: 
{options}"""
        if is_reasoning:
            prompt = prompt + "\n" + 'Answer with the option\'s letter from the given choices and put the letter in one "\\boxed{}".'
        else:
            prompt = prompt + "\n" + "Answer with the option's letter from the given choices directly." 

    elif lang == "zh":
        prompt = f"""
问题: {question}
选项: 
{options}"""
        if is_reasoning:
            prompt = prompt + "\n" + '请直接使用给定选项中的选项字母来回答该问题,并将答案包裹在"\\boxed{}"里'
        else:
            prompt = prompt + "\n" +  "请直接使用给定选项中的选项字母来回答该问题。"
    return prompt

def get_judgement_prompt(question,is_reasoning = False, lang = "en"):
    if lang == "en":
        if is_reasoning:
            prompt = question + "\n" + 'Please output "yes" or "no" and put the answer in one "\\boxed{}".'
        else:
            prompt = question + "\n" + "Please output 'yes' or 'no'(no extra output)."
    elif lang == "zh":
        if is_reasoning:
            prompt = question + "\n" + "请输出'是'或'否',并将答案放在一个'\\boxed{}'中。"
        else:
            prompt = question + "\n" + "请输出'是'或'否'(不要有任何其它输出)。"
    return prompt

def get_close_ended_prompt(question,is_reasoning = False, lang = "en"):
    if lang == "en":
        if is_reasoning:
            prompt = question + "\n" + 'Answer the question using a single word or phrase and put the answer in one "\\boxed{}".'
        else:
            prompt = question + "\n" + "Answer the question using a single word or phrase."
    elif lang == "zh":
        if is_reasoning:
            prompt = question + "\n" + "请用一个单词或者短语回答该问题,并将答案放在一个'\\boxed{}'中。"
        else:
            prompt = question + "\n" + "请用一个单词或者短语回答该问题。"
    return prompt

def get_open_ended_prompt(question,is_reasoning = False, lang = "en"):
    if lang == "en":
        if is_reasoning:
            prompt = question + "\n" + 'Please answer the question concisely and put the answer in one "\\boxed{}".'
        else:
            prompt = question + "\n" + "Please answer the question concisely."
    elif lang == "zh":
        if is_reasoning:
            prompt = question + "\n" + "请简要回答该问题,并将答案放在一个'\\boxed{}'中。"
        else:
            prompt = question + "\n" + "请简要回答该问题。"
    return prompt

def get_report_generation_prompt():
    prompt = "You are a helpful assistant. Please generate a report for the given images, including both findings and impressions. Return the report in the following format: Findings: {} Impression: {}."
    return prompt