Spaces:
Build error
Build error
corrected excel tool, added mp3 tool
Browse filesFiles changed (3)
14 unmodified lines1516171819202136 unmodified lines5859606162636414 unmodified linesdataclasses-json==0.6.7distro==1.9.0docutils==0.21.2et_xmlfile==2.0.0fastapi==0.115.12feedparser==6.0.11ffmpy==0.5.036 unmodified linesmypy_extensions==1.1.0numpy==2.2.6openai==1.81.0openpyxl==3.1.5orjson==3.10.18ormsgpack==1.9.1packaging==24.21 unmodified line23456781 unmodified lineBefore 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.If there is an MP3 file attached (file name and file URL) use tool for getting content by transcribing text out of file 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.11 unmodified lines1213141516171819118 unmodified lines13813914014114214314414514614714814915015115215315415515615715815916016116216316416516616714216816917017111 unmodified linesimport osimport base64import requestsimport pandas as pdfrom openai import OpenAI
llm = ChatOpenAI(model="gpt-4.1")
118 unmodified lines # return the content return content
@tooldef transcribe_audio_mp3_file(mp3_file_url: str) -> str: """Download Mp3 file, transcribe audio and return text"""
# download the image using requests library response = requests.get(mp3_file_url)
# save the file to a temporary location temp_file_path = "/tmp/temp.mp3" with open(temp_file_path, "wb") as file: file.write(response.content)
client = OpenAI() audio_file = open(temp_file_path, "rb")
transcription = client.audio.transcriptions.create( model="gpt-4o-transcribe", file=audio_file, response_format="text" )
# return the content return transcription
def 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] wikidata_search, wikipedia_search, download_image_and_analyze, get_excel_file_content, transcribe_audio_mp3_file]
# HUGGINGFACEHUB_API_TOKEN = os.getenv("HUGGINGFACEHUB_API_TOKEN")
requirements.txt+2
system_prompt.txt+1
unit4agent.py+27-1