chore: update something
Browse files
app.py
CHANGED
|
@@ -286,7 +286,7 @@ supported_tools = json.dumps(
|
|
| 286 |
"type": "function",
|
| 287 |
"function": {
|
| 288 |
"name": "search_on_internet",
|
| 289 |
-
"description": "Use this tool to search for information on the internet
|
| 290 |
"parameters": {
|
| 291 |
"type": "object",
|
| 292 |
"properties": {
|
|
@@ -295,13 +295,13 @@ supported_tools = json.dumps(
|
|
| 295 |
"description": "Search keywords, rephrase to optimize search results based on questions suitable to the specified search type.",
|
| 296 |
"required": True,
|
| 297 |
},
|
| 298 |
-
"type": {
|
| 299 |
-
|
| 300 |
-
|
| 301 |
-
|
| 302 |
-
|
| 303 |
-
|
| 304 |
-
},
|
| 305 |
"language": {
|
| 306 |
"type": "string",
|
| 307 |
"description": "Search language, is the user language code with 2 letters, e.g: vi = vietnamese, en = english.",
|
|
@@ -486,20 +486,20 @@ def generate(
|
|
| 486 |
and scheduled_tools_runs["name"] == "search_on_internet"
|
| 487 |
):
|
| 488 |
keyword = scheduled_tools_runs["arguments"]["keyword"]
|
| 489 |
-
search_type = scheduled_tools_runs["arguments"]["type"]
|
| 490 |
language = scheduled_tools_runs["arguments"]["language"]
|
| 491 |
print(
|
| 492 |
"scheduled_tools_runs:", scheduled_tools_runs
|
| 493 |
)
|
| 494 |
-
if search_type == "wikipedia":
|
| 495 |
-
|
| 496 |
-
|
| 497 |
-
|
| 498 |
-
|
| 499 |
-
|
| 500 |
-
|
| 501 |
-
|
| 502 |
-
|
| 503 |
|
| 504 |
gr.Info(
|
| 505 |
"Searching for information on the Google.", duration=5, visible=True
|
|
@@ -508,7 +508,8 @@ def generate(
|
|
| 508 |
search_with_google(
|
| 509 |
query=keyword,
|
| 510 |
language=language,
|
| 511 |
-
num_results=
|
|
|
|
| 512 |
)
|
| 513 |
)
|
| 514 |
print(
|
|
|
|
| 286 |
"type": "function",
|
| 287 |
"function": {
|
| 288 |
"name": "search_on_internet",
|
| 289 |
+
"description": "Use this tool to search for information on the internet to answer questions you are unsure about, don't know, or need the latest information to get the most accurate results.",
|
| 290 |
"parameters": {
|
| 291 |
"type": "object",
|
| 292 |
"properties": {
|
|
|
|
| 295 |
"description": "Search keywords, rephrase to optimize search results based on questions suitable to the specified search type.",
|
| 296 |
"required": True,
|
| 297 |
},
|
| 298 |
+
# "type": {
|
| 299 |
+
# "type": "string",
|
| 300 |
+
# "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.",
|
| 301 |
+
# "enum": ["wikipedia", "google"],
|
| 302 |
+
# "default": "google",
|
| 303 |
+
# "required": True,
|
| 304 |
+
# },
|
| 305 |
"language": {
|
| 306 |
"type": "string",
|
| 307 |
"description": "Search language, is the user language code with 2 letters, e.g: vi = vietnamese, en = english.",
|
|
|
|
| 486 |
and scheduled_tools_runs["name"] == "search_on_internet"
|
| 487 |
):
|
| 488 |
keyword = scheduled_tools_runs["arguments"]["keyword"]
|
| 489 |
+
# search_type = scheduled_tools_runs["arguments"]["type"]
|
| 490 |
language = scheduled_tools_runs["arguments"]["language"]
|
| 491 |
print(
|
| 492 |
"scheduled_tools_runs:", scheduled_tools_runs
|
| 493 |
)
|
| 494 |
+
# if search_type == "wikipedia":
|
| 495 |
+
# gr.Info(
|
| 496 |
+
# "Searching for information on the Wikipedia.",
|
| 497 |
+
# duration=5,
|
| 498 |
+
# visible=True,
|
| 499 |
+
# )
|
| 500 |
+
# document_references.extend(
|
| 501 |
+
# search_with_wikipedia(query=keyword, language=language)
|
| 502 |
+
# )
|
| 503 |
|
| 504 |
gr.Info(
|
| 505 |
"Searching for information on the Google.", duration=5, visible=True
|
|
|
|
| 508 |
search_with_google(
|
| 509 |
query=keyword,
|
| 510 |
language=language,
|
| 511 |
+
num_results=4,
|
| 512 |
+
# num_results=2 if search_type == "wikipedia" else 3,
|
| 513 |
)
|
| 514 |
)
|
| 515 |
print(
|