Spaces:
Sleeping
Sleeping
Update tools.py
Browse files
tools.py
CHANGED
|
@@ -135,15 +135,15 @@ def wiki_search(query: str) -> str:
|
|
| 135 |
|
| 136 |
Args:
|
| 137 |
query: The search query for SPARQL."""
|
| 138 |
-
|
| 139 |
-
|
| 140 |
-
|
| 141 |
-
|
| 142 |
-
|
| 143 |
-
|
| 144 |
-
|
| 145 |
-
|
| 146 |
-
|
| 147 |
|
| 148 |
@tool
|
| 149 |
def transcribe_audio(file_path: str) -> str:
|
|
|
|
| 135 |
|
| 136 |
Args:
|
| 137 |
query: The search query for SPARQL."""
|
| 138 |
+
try:
|
| 139 |
+
endpoint = SPARQLWrapper("https://query.wikidata.org/sparql")
|
| 140 |
+
endpoint.setQuery(query)
|
| 141 |
+
endpoint.setReturnFormat(JSON)
|
| 142 |
+
|
| 143 |
+
results = endpoint.query().convert()
|
| 144 |
+
return json.dumps(results, indent=2)
|
| 145 |
+
except Exception as e:
|
| 146 |
+
return f"Error executing SPARQL query: {str(e)}"
|
| 147 |
|
| 148 |
@tool
|
| 149 |
def transcribe_audio(file_path: str) -> str:
|