lamhieu commited on
Commit
313f431
1 Parent(s): e0afec8

chore: update something

Browse files
Files changed (1) hide show
  1. app.py +20 -19
app.py CHANGED
@@ -277,7 +277,7 @@ supported_tools = json.dumps(
277
  "type": "function",
278
  "function": {
279
  "name": "search_on_internet",
280
- "description": "Use this tool to search for information on the internet so you can provide answers to questions that require a high level of precision, or information you are unsure of. In addition, you can also refer to questions related to time, events, news or geopolitics. Don't misuse tools.",
281
  "parameters": {
282
  "type": "object",
283
  "properties": {
@@ -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
- "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,18 +477,18 @@ def generate(
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(
494
  "Searching for information on the Google.", duration=5, visible=True
@@ -497,7 +497,8 @@ def generate(
497
  search_with_google(
498
  query=keyword,
499
  language=language,
500
- num_results=2 if search_type == "wikipedia" else 3,
 
501
  )
502
  )
503
  print("document_references:", document_references)
 
277
  "type": "function",
278
  "function": {
279
  "name": "search_on_internet",
280
+ "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.",
281
  "parameters": {
282
  "type": "object",
283
  "properties": {
 
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(
494
  "Searching for information on the Google.", duration=5, visible=True
 
497
  search_with_google(
498
  query=keyword,
499
  language=language,
500
+ num_results=4,
501
+ # num_results=2 if search_type == "wikipedia" else 3,
502
  )
503
  )
504
  print("document_references:", document_references)