Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -22,7 +22,12 @@ class CurrentTimeTool(Tool):
|
|
| 22 |
super().__init__()
|
| 23 |
self.name="gettime"
|
| 24 |
self.description = "Fetches the current local time in a specified timezone. Input should be a timezone string like 'America/New_York'."
|
| 25 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 26 |
def __call__(self, timezone: str) -> str:
|
| 27 |
try:
|
| 28 |
tz = pytz.timezone(timezone)
|
|
@@ -37,7 +42,18 @@ class WikipediaTool(Tool):
|
|
| 37 |
super().__init__()
|
| 38 |
self.name="searchwiki"
|
| 39 |
self.description = "Searches Wikipedia for information. Input should be a search query. Optional parameter 'sentences' (default 2) controls summary length."
|
| 40 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 41 |
def __call__(self, query: str, sentences: int = 2) -> str:
|
| 42 |
try:
|
| 43 |
return wikipedia.summary(query, sentences=sentences)
|
|
|
|
| 22 |
super().__init__()
|
| 23 |
self.name="gettime"
|
| 24 |
self.description = "Fetches the current local time in a specified timezone. Input should be a timezone string like 'America/New_York'."
|
| 25 |
+
self.inputs = {
|
| 26 |
+
"timezone": {
|
| 27 |
+
"type": "string",
|
| 28 |
+
"description": "Timezone string (e.g., 'America/New_York')"
|
| 29 |
+
}
|
| 30 |
+
}
|
| 31 |
def __call__(self, timezone: str) -> str:
|
| 32 |
try:
|
| 33 |
tz = pytz.timezone(timezone)
|
|
|
|
| 42 |
super().__init__()
|
| 43 |
self.name="searchwiki"
|
| 44 |
self.description = "Searches Wikipedia for information. Input should be a search query. Optional parameter 'sentences' (default 2) controls summary length."
|
| 45 |
+
self.inputs = {
|
| 46 |
+
"query": {
|
| 47 |
+
"type": "string",
|
| 48 |
+
"description": "Search query"
|
| 49 |
+
},
|
| 50 |
+
"sentences": {
|
| 51 |
+
"type": "integer",
|
| 52 |
+
"description": "Number of summary sentences",
|
| 53 |
+
"default": 2
|
| 54 |
+
}
|
| 55 |
+
}
|
| 56 |
+
|
| 57 |
def __call__(self, query: str, sentences: int = 2) -> str:
|
| 58 |
try:
|
| 59 |
return wikipedia.summary(query, sentences=sentences)
|