Lumintroll commited on
Commit
dfec607
·
1 Parent(s): 2d02cb7

Additional tools added

Browse files
Files changed (1) hide show
  1. agent_tools.py +13 -4
agent_tools.py CHANGED
@@ -56,15 +56,24 @@ def get_remote_file(url: str) -> IO:
56
  print(f"Failed to retrieve the file. Status code: {response.status_code}")
57
 
58
  @tool
59
- def excel_reader(file_data: IO) -> pd.DataFrame:
60
  """
61
- This tool returns a pandas dataframe from a file locally, from a URL or from bytes data.
62
  Args:
63
  file_data: A file location as a string (either a local file or url of xlsx file) or IO file data of an xlsx to read in as a dataframe.
64
- If a file is forbidden to be accessed directly, another approach is to download the file data with get_remote_file as bytes and use that instead of a URL.
65
  """
66
  return pd.read_excel(file_data, engine="openpyxl")
67
 
 
 
 
 
 
 
 
 
 
 
68
  #mp3 transcription
69
  @tool
70
  def audio_transcription_tool(media_data: IO) -> dict:
@@ -126,7 +135,7 @@ def string_reverser(text: str) -> str:
126
  """
127
  return text[::-1]
128
 
129
- custom_tools = [get_remote_file, excel_reader, audio_transcription_tool, string_reverser]
130
  default_tools = [DuckDuckGoSearchTool(), WikipediaSearchTool(), VisitWebpageTool(), SpeechToTextTool()]
131
  tools = custom_tools + default_tools
132
 
 
56
  print(f"Failed to retrieve the file. Status code: {response.status_code}")
57
 
58
  @tool
59
+ def excel_reader_io(file_data: IO) -> pd.DataFrame:
60
  """
61
+ This tool returns a pandas dataframe from a from bytes data.
62
  Args:
63
  file_data: A file location as a string (either a local file or url of xlsx file) or IO file data of an xlsx to read in as a dataframe.
 
64
  """
65
  return pd.read_excel(file_data, engine="openpyxl")
66
 
67
+ @tool
68
+ def excel_reader_url(file_or_url: str) -> pd.DataFrame:
69
+ """
70
+ This tool returns a pandas dataframe from a file locally or from a URL.
71
+ Args:
72
+ file_or_url: A file location as a string (either a local file or url of xlsx file) or IO file data of an xlsx to read in as a dataframe.
73
+ If a file is forbidden to be accessed directly, another approach is to download the file data with get_remote_file as bytes and use that instead of a URL.
74
+ """
75
+ return pd.read_excel(file_or_url, engine="openpyxl")
76
+
77
  #mp3 transcription
78
  @tool
79
  def audio_transcription_tool(media_data: IO) -> dict:
 
135
  """
136
  return text[::-1]
137
 
138
+ custom_tools = [get_remote_file, excel_reader_io, excel_reader_url, audio_transcription_tool, string_reverser, text_from_pdf, youtube_transcriber]
139
  default_tools = [DuckDuckGoSearchTool(), WikipediaSearchTool(), VisitWebpageTool(), SpeechToTextTool()]
140
  tools = custom_tools + default_tools
141