Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -39,6 +39,21 @@ class LoadCsvTool(Tool):
|
|
| 39 |
def forward(self, file_path: str) -> str:
|
| 40 |
return pd.read_csv(file_path)
|
| 41 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 42 |
class WikipediaTool(Tool):
|
| 43 |
name = "wikipedia_search"
|
| 44 |
description = "Fetch Wikipedia summary for a topic. Input: topic string."
|
|
|
|
| 39 |
def forward(self, file_path: str) -> str:
|
| 40 |
return pd.read_csv(file_path)
|
| 41 |
|
| 42 |
+
from smolagents import Tool
|
| 43 |
+
|
| 44 |
+
class WebhookPostTool(Tool):
|
| 45 |
+
name = "webhook_post"
|
| 46 |
+
description = "Send a JSON payload to a webhook URL and return the response as text."
|
| 47 |
+
output_type = str # Must be one of SmolAgents authorized types
|
| 48 |
+
|
| 49 |
+
def forward(self, webhook_url: str, payload: dict) -> str:
|
| 50 |
+
try:
|
| 51 |
+
response = requests.post(webhook_url, json=payload)
|
| 52 |
+
return response.text
|
| 53 |
+
except Exception as e:
|
| 54 |
+
return f"Error sending request: {str(e)}"
|
| 55 |
+
|
| 56 |
+
|
| 57 |
class WikipediaTool(Tool):
|
| 58 |
name = "wikipedia_search"
|
| 59 |
description = "Fetch Wikipedia summary for a topic. Input: topic string."
|