Spaces:
Build error
Build error
upgraded prompt, added Excel tool
Browse filesFiles changed (2)
- system_prompt.txt+13-3
- unit4agent.py+24-3
122345657891011127 unmodified lines2021221923242526272829You 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.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 and thoughts into the answer. Just provide response in the format above. Do not use any kind of surrounding brackets in 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, fetatomatoes, cucumbers, red onion, green bell pepper, black olives, feta
Example 3 question:How many at bats did the Yankee in 1977 have that same season?
Example 3 answer:50784 unmodified lines858687888889909110 unmodified lines1021031041051051061071086 unmodified lines11511611711811912012112212312412512612712812913013113213313413513613713813914014112114214314414584 unmodified lines
# image analysis tool@tooldef download_image_and_analyze(image_file_extension: str, image_url: str, question: str) -> str:def 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": question}, {"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 library response = requests.get(excel_file_url)
# save the file to a temporary location temp_file_path = "/tmp/temp.xlsx" with open(temp_file_path, "wb") as file: file.write(response.content)
# read the content of the file df = pd.read_excel(temp_file_path)
# convert the content to a string content = df.to_string()
# return the content return content
def compile_agent():
tools = [multiply, divide, add, subtract, square_root, web_search_tool, arxiv_search, wikidata_search, wikipedia_search, download_image_and_analyze] 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