Spaces:
Runtime error
Runtime error
Commit ·
92d1bac
1
Parent(s): d1e350b
More helpful dataframes tool
Browse files- agent_tools.py +7 -1
- app.py +1 -1
agent_tools.py
CHANGED
|
@@ -108,6 +108,7 @@ def audio_transcription_tool(media_data: IO) -> dict:
|
|
| 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
|
|
@@ -115,7 +116,12 @@ def dataframes_from_website(url:str) -> list:
|
|
| 115 |
Returns:
|
| 116 |
list: List of pandas dataframes
|
| 117 |
"""
|
| 118 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 119 |
|
| 120 |
#chess analysis
|
| 121 |
|
|
|
|
| 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 |
+
If a tool that visits a webpage identifes a table, it's worth running this tool in case an answer can be easily derived.
|
| 112 |
|
| 113 |
Args:
|
| 114 |
url (str): Web page which contains one or more tables
|
|
|
|
| 116 |
Returns:
|
| 117 |
list: List of pandas dataframes
|
| 118 |
"""
|
| 119 |
+
dfs = pd.read_html(url)
|
| 120 |
+
|
| 121 |
+
for count, df in enumerate(dfs):
|
| 122 |
+
print(f"---First rows of df[{count}]---\n")
|
| 123 |
+
print(df.head(3), "\n")
|
| 124 |
+
return
|
| 125 |
|
| 126 |
#chess analysis
|
| 127 |
|
app.py
CHANGED
|
@@ -17,7 +17,7 @@ class BasicAgent:
|
|
| 17 |
print("BasicAgent initialized.")
|
| 18 |
def __call__(self, question: str) -> str:
|
| 19 |
print(f"Agent received question (first 50 chars): {question[:50]}...")
|
| 20 |
-
fixed_answer = self.agent.run(question + "\n\nEnsure any code is correctly formatted inside blobs. Remember, incorrectly formatted code kills a kitten. Keep track of the number of kittens you kill and each time note the code mistake you made. You do not like chess or birds, your final answer
|
| 21 |
print(f"Agent returning fixed answer: {fixed_answer}")
|
| 22 |
return fixed_answer
|
| 23 |
|
|
|
|
| 17 |
print("BasicAgent initialized.")
|
| 18 |
def __call__(self, question: str) -> str:
|
| 19 |
print(f"Agent received question (first 50 chars): {question[:50]}...")
|
| 20 |
+
fixed_answer = self.agent.run(question + "\n\nEnsure any code is correctly formatted inside blobs. Remember, incorrectly formatted code kills a kitten. Keep track of the number of kittens you kill and each time note the code mistake you made. You do not like chess or birds, your final answer for questions about them should be N/A.")
|
| 21 |
print(f"Agent returning fixed answer: {fixed_answer}")
|
| 22 |
return fixed_answer
|
| 23 |
|