File size: 5,120 Bytes
9ac9d5e
 
 
 
 
 
 
 
 
64c3879
 
 
 
 
 
 
a9182c5
 
 
 
 
 
 
5037c4d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9ac9d5e
 
 
 
64c3879
 
 
9ac9d5e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
a9182c5
11ae913
9ac9d5e
 
 
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
 # Promts

def get_web_search_prompt(message, file_path=None):
    prompt = f"""
    As an expert web search assistant, you search the web to answer the question. Your task is to search the web and provide accurate answers to the question: {message}
        """

    return prompt

def get_image_analysis_prompt(message, file_path=None):
    prompt = f"""
    As an expert image analysis assistant, you analyze the image to answer the question. Given a question and image file, analyze the image and answer the question: {message}
        """

    return prompt

def get_audio_analysis_prompt(message, file_path=None):
    prompt = f"""
    As an expert audio analysis assistant, you analyze the audio to answer the question. Given a question and audio file, analyze the audio and answer the question: {message}
        """

    return prompt

def get_video_analysis_prompt(message, file_path=None):
    prompt = f"""
    As an expert video analysis assistant, you analyze the video to answer the question. Given a question and video file, analyze the video and answer the question: {message}
        """

    return prompt

def get_youtube_analysis_prompt(message, file_path=None):
    prompt = f"""
    As an expert YouTube analysis assistant, you analyze the video to answer the question. Given a question and YouTube URL, analyze the video and answer the question: {message}
        """

    return prompt

def get_document_analysis_prompt(message, file_path=None):
    prompt = f"""
    As an expert document analysis assistant, you analyze the document to answer the question. Given a question and document file, analyze the document and answer the question: {message}
        """

    return prompt 

def get_arithmetic_prompt(message, file_path=None):
    prompt = f"""
     As an expert arithmetic assistant, you perform the calculation to answer the question. Given a question and two numbers, perform the calculation and answer the question: {message}
        """

    return prompt 

def get_code_generation_prompt(message, file_path=None):
    prompt = f"""
     As an expert Python code generation assistant, you generate and execute code to answer the question. Given a question and JSON data, generate and execute code to answer the question: {message}
        """

    return prompt   

def get_code_execution_prompt(message, file_path=None):
    prompt = f"""
    As an expert Python code execution assistant, you execute code to answer the question. Given a question and Python file, execute the file to answer the question: {message}
        """

    return prompt  

def get_manager_prompt(message, file_path=None):
    prompt = f"""Your job is to answer the following question. 
        Answer the following question. If needed, delegate to one of your coworkers:\n

        - Web Search Agent: requires a question only.\n

        - Image Analysis Agent: requires a question and **.png, .jpeg, .webp, .heic, or .heif image file**.\n"

        ...

        In case you cannot answer the question and there is not a good coworker, delegate to the Code Generation Agent.\n.

        Question: {message}
        """

    return prompt

def get_final_answer_prompt(message: str, initial_answer: str):
    prompt = f"""
            You are an expert question answering assistant. Given a question and an initial answer, your task is to provide the final answer.
        Your final answer must be a number and/or string OR as few words as possible OR a comma-separated list of numbers and/or strings.
        If you are asked for a number, don't use comma to write your number neither use units such as USD, $, percent, or % unless specified otherwise.
        If you are asked for a string, don't use articles, neither abbreviations (for example cities), and write the digits in plain text unless specified otherwise.
        If you are asked for a comma-separated list, apply the above rules depending of whether the element to be put in the list is a number or a string.
        If the final answer is a number, use a number not a word.
        If the final answer is a string, start with an uppercase character.
        If the final answer is a comma-separated list of numbers, use a space character after each comma.
        If the final answer is a comma-separated list of strings, use a space character after each comma and start with a lowercase character.
        Do not add any content to the final answer that is not in the initial answer.
        
        **Question:** """ + message + """
        
        **Initial answer:** """ + initial_answer + """
        
        **Example 1:** What is the biggest city in California? Los Angeles
        **Example 2:** How many 'r's are in strawberry? 3
        **Example 3:** What is the opposite of black? White
        **Example 4:** What are the first 5 numbers in the Fibonacci sequence? 0, 1, 1, 2, 3
        **Example 5:** What is the opposite of bad, worse, worst? good, better, best
        
        **Final answer:**

        The final answer must always be in text format and no other formats are acceptable.
        """

    return prompt