Spaces:
Build error
Build error
upgraded prompt, added Excel tool
Browse filesFiles changed (2)
- system_prompt.txt+13-3
- unit4agent.py+24-3
123456787 unmodified lines16171819You are a helpful assistant. You must answer a question with a set of available tools.Before answering please create a plan how to get additional information (via tools) before starting analysis. If there is an image attached (file name and file URL) use tool for automatic image download and analysis with precise question.Format of your answer - [ANSWER]. [ANSWER] can be a number, list of items divided by comma or a string. Be very concise and clear with the answer.Do not include any plans and thoughts into the answer. Just provide response in the format above. Do not use any kind of surrounding brackets in answer.Here are examples of how to answer.7 unmodified linesWhat are greek salad ingredients?Example 2 answer:tomatoes, cucumbers, red onion, green bell pepper, black olives, feta1234567891011127 unmodified lines20212223242526272829You are a helpful assistant. You must answer a question with a set of available tools.Before answering please create a plan how to get additional information (via tools) before starting analysis.If there is an image attached (file name and file URL) use tool for automatic image download and analysis with precise question.If there is an Excel file attached (file name and file URL) use tool for getting content of the Excel file from URL.Format of your answer - [ANSWER]. [ANSWER] can be a number, list of items divided by comma or a string. Be very concise and clear with the answer.Do not include any plans, thoughts and explanations into the answer. Just provide concise and unambiguous answer in the format above.Do not use any kind of surrounding brackets in answer.Do not write "Answer", "Final answer" before the real answer.Here are examples of how to answer.7 unmodified linesWhat are greek salad ingredients?Example 2 answer:tomatoes, cucumbers, red onion, green bell pepper, black olives, fetaExample 3 question:How many at bats did the Yankee in 1977 have that same season?Example 3 answer:507
84 unmodified lines8586878889909110 unmodified lines1021031041051061071086 unmodified lines11511611711811912012112212312484 unmodified lines# image analysis tool@tooldef download_image_and_analyze(image_file_extension: str, image_url: str, question: str) -> str:"""Download and analyze the image"""# download the image using requests library10 unmodified lines[HumanMessage(content=[{"type": "text", "text": question},{"type": "image_url","image_url": {6 unmodified lines)return msg.contentdef compile_agent():tools = [multiply, divide, add, subtract, square_root, web_search_tool, arxiv_search,wikidata_search, wikipedia_search, download_image_and_analyze]# HUGGINGFACEHUB_API_TOKEN = os.getenv("HUGGINGFACEHUB_API_TOKEN")84 unmodified lines8586878889909110 unmodified lines1021031041051061071086 unmodified lines11511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414584 unmodified lines# image analysis tool@tooldef download_image_and_analyze(image_file_extension: str, image_url: str, image_analysis_question: str) -> str:"""Download and analyze the image"""# download the image using requests library10 unmodified lines[HumanMessage(content=[{"type": "text", "text": image_analysis_question},{"type": "image_url","image_url": {6 unmodified lines)return msg.content@tooldef get_excel_file_content(excel_file_url: str) -> str:"""Download Excel file and extract its content"""# download the image using requests libraryresponse = requests.get(excel_file_url)# save the file to a temporary locationtemp_file_path = "/tmp/temp.xlsx"with open(temp_file_path, "wb") as file:file.write(response.content)# read the content of the filedf = pd.read_excel(temp_file_path)# convert the content to a stringcontent = df.to_string()# return the contentreturn contentdef compile_agent():tools = [multiply, divide, add, subtract, square_root, web_search_tool, arxiv_search,wikidata_search, wikipedia_search, download_image_and_analyze, get_excel_file_content]# HUGGINGFACEHUB_API_TOKEN = os.getenv("HUGGINGFACEHUB_API_TOKEN")
system_prompt.txt+13-3
unit4agent.py+24-3