Spaces:
Sleeping
Sleeping
# 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 |