Lumintroll commited on
Commit
eb82740
·
1 Parent(s): d96b45f

Table reader added

Browse files
__pycache__/agent_tools.cpython-310.pyc CHANGED
Binary files a/__pycache__/agent_tools.cpython-310.pyc and b/__pycache__/agent_tools.cpython-310.pyc differ
 
agent_tools.py CHANGED
@@ -103,6 +103,20 @@ def audio_transcription_tool(media_data: IO) -> dict:
103
 
104
  #python code running
105
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
106
  #chess analysis
107
 
108
  #pdf reader
@@ -138,7 +152,8 @@ def string_reverser(text: str) -> str:
138
  """
139
  return text[::-1]
140
 
141
- custom_tools = [get_remote_file, excel_reader_io, excel_reader_url, audio_transcription_tool, string_reverser, text_from_pdf, youtube_transcriber]
 
142
  default_tools = [DuckDuckGoSearchTool(), WikipediaSearchTool(), VisitWebpageTool(), SpeechToTextTool()]
143
  tools = custom_tools + default_tools
144
 
@@ -149,7 +164,7 @@ model = AzureOpenAIServerModel(
149
  azure_endpoint=os.environ.get("AZURE_OPENAI_ENDPOINT"),
150
  api_key=os.environ.get("AZURE_OPENAI_API_KEY"),
151
  api_version=os.environ.get("OPENAI_API_VERSION"),
152
- #max_tokens=4096
153
  )
154
 
155
  planning_steps = 1
 
103
 
104
  #python code running
105
 
106
+ #tables from webpage
107
+ @tool
108
+ def dataframes_from_website(url:str) -> list:
109
+ """Returns a list of pandas dataframes from all tables found at a given url. This is useful for working with tabulated data on Wikipedia pages etc.
110
+ You can efficiently conduct sums, counts etc once you identify the correct table from the list of dataframes returned.
111
+
112
+ Args:
113
+ url (str): Web page which contains one or more tables
114
+
115
+ Returns:
116
+ list: List of pandas dataframes
117
+ """
118
+ return pd.read_html(url)
119
+
120
  #chess analysis
121
 
122
  #pdf reader
 
152
  """
153
  return text[::-1]
154
 
155
+ custom_tools = [get_remote_file, excel_reader_io, excel_reader_url, audio_transcription_tool, string_reverser,
156
+ text_from_pdf, youtube_transcriber, dataframes_from_website]
157
  default_tools = [DuckDuckGoSearchTool(), WikipediaSearchTool(), VisitWebpageTool(), SpeechToTextTool()]
158
  tools = custom_tools + default_tools
159
 
 
164
  azure_endpoint=os.environ.get("AZURE_OPENAI_ENDPOINT"),
165
  api_key=os.environ.get("AZURE_OPENAI_API_KEY"),
166
  api_version=os.environ.get("OPENAI_API_VERSION"),
167
+ max_tokens=4096
168
  )
169
 
170
  planning_steps = 1