Spaces:
Paused
Paused
chore: update something
Browse files
app.py
CHANGED
|
@@ -286,13 +286,13 @@ supported_tools = json.dumps(
|
|
| 286 |
"description": "Search keywords, rephrase to optimize search results based on questions suitable to the specified search type.",
|
| 287 |
"required": True,
|
| 288 |
},
|
| 289 |
-
|
| 290 |
-
|
| 291 |
-
|
| 292 |
-
|
| 293 |
-
|
| 294 |
-
|
| 295 |
-
|
| 296 |
"language": {
|
| 297 |
"type": "string",
|
| 298 |
"description": "Search language, is the user language code with 2 letters, e.g: vi = vietnamese, en = english.",
|
|
@@ -477,25 +477,25 @@ def generate(
|
|
| 477 |
and scheduled_tools_runs["name"] == "search_on_internet"
|
| 478 |
):
|
| 479 |
keyword = scheduled_tools_runs["arguments"]["keyword"]
|
| 480 |
-
|
| 481 |
language = scheduled_tools_runs["arguments"]["language"]
|
| 482 |
print("scheduled_tools_runs:", scheduled_tools_runs)
|
| 483 |
-
|
| 484 |
-
|
| 485 |
-
|
| 486 |
-
|
| 487 |
-
|
| 488 |
-
|
| 489 |
-
|
| 490 |
-
|
| 491 |
-
|
| 492 |
|
| 493 |
gr.Info("Searching for information on the Google.")
|
| 494 |
document_references.extend(
|
| 495 |
search_with_google(
|
| 496 |
query=keyword,
|
| 497 |
language=language,
|
| 498 |
-
num_results=
|
| 499 |
# num_results=2 if search_type == "wikipedia" else 3,
|
| 500 |
)
|
| 501 |
)
|
|
|
|
| 286 |
"description": "Search keywords, rephrase to optimize search results based on questions suitable to the specified search type.",
|
| 287 |
"required": True,
|
| 288 |
},
|
| 289 |
+
"type": {
|
| 290 |
+
"type": "string",
|
| 291 |
+
"description": "Search type, based on the question to determine whether to search for it in 'wikipedia' or 'google', prefer to use wikipedia for information about events, history and people.",
|
| 292 |
+
"enum": ["wikipedia", "google"],
|
| 293 |
+
"default": "google",
|
| 294 |
+
"required": True,
|
| 295 |
+
},
|
| 296 |
"language": {
|
| 297 |
"type": "string",
|
| 298 |
"description": "Search language, is the user language code with 2 letters, e.g: vi = vietnamese, en = english.",
|
|
|
|
| 477 |
and scheduled_tools_runs["name"] == "search_on_internet"
|
| 478 |
):
|
| 479 |
keyword = scheduled_tools_runs["arguments"]["keyword"]
|
| 480 |
+
search_type = scheduled_tools_runs["arguments"]["type"]
|
| 481 |
language = scheduled_tools_runs["arguments"]["language"]
|
| 482 |
print("scheduled_tools_runs:", scheduled_tools_runs)
|
| 483 |
+
if search_type == "wikipedia":
|
| 484 |
+
gr.Info(
|
| 485 |
+
"Searching for information on the Wikipedia.",
|
| 486 |
+
duration=5,
|
| 487 |
+
visible=True,
|
| 488 |
+
)
|
| 489 |
+
document_references.extend(
|
| 490 |
+
search_with_wikipedia(query=keyword, language=language)
|
| 491 |
+
)
|
| 492 |
|
| 493 |
gr.Info("Searching for information on the Google.")
|
| 494 |
document_references.extend(
|
| 495 |
search_with_google(
|
| 496 |
query=keyword,
|
| 497 |
language=language,
|
| 498 |
+
num_results=3,
|
| 499 |
# num_results=2 if search_type == "wikipedia" else 3,
|
| 500 |
)
|
| 501 |
)
|