lamhieu commited on
Commit
3ff035f
1 Parent(s): 4c4cb2e

chore: update something

Browse files
Files changed (1) hide show
  1. app.py +18 -19
app.py CHANGED
@@ -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
- # "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,28 +486,27 @@ 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
- # 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("Searching for information on the Google.")
505
  document_references.extend(
506
  search_with_google(
507
  query=keyword,
508
  language=language,
509
- num_results=4,
510
- # num_results=2 if search_type == "wikipedia" else 3,
511
  )
512
  )
513
  print(
 
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("Searching for information on the Google.")
505
  document_references.extend(
506
  search_with_google(
507
  query=keyword,
508
  language=language,
509
+ num_results=3,
 
510
  )
511
  )
512
  print(