Ahmet Zelka commited on
Commit
e9e6271
·
verified ·
1 Parent(s): 39d611d

fixed return statement

Browse files
Files changed (1) hide show
  1. app.py +18 -21
app.py CHANGED
@@ -13,23 +13,23 @@ from Gradio_UI import GradioUI
13
  def paper_finder(topics:list, max_paper:int)-> str: #it's import to specify the return type
14
  #Keep this format for the description / args / args description but feel free to modify the tool
15
  """
16
- Searches arxiv.org for the most recently updated research papers on specified topics.
17
-
18
- This tool leverages the arXiv API to fetch the latest research papers based on their update dates.
19
- For each topic provided, it returns up to `max_paper` number of papers. Each paper entry includes:
20
- - **Title:** The paper's title.
21
- - **Authors:** The names of the first three authors (an ellipsis is added if there are more).
22
- - **Published Date:** The publication date (formatted as YYYY-MM-DD).
23
- - **Summary:** A short, truncated summary of the paper.
24
- - **PDF Link:** A direct link to the paper's PDF (if available).
25
-
26
- **Args:**
27
- topics (list): A list of topic keywords or phrases (e.g., ['Computer Vision', 'NLP']) to guide the search.
28
- max_paper (int): The maximum number of papers to retrieve for each topic.
29
-
30
- **Returns:**
31
- str: A markdown-formatted string that summarizes the latest papers for each topic.
32
- If an error occurs during the search for a topic, an error message will be included.
33
  """
34
 
35
  results = []
@@ -92,10 +92,7 @@ def paper_finder(topics:list, max_paper:int)-> str: #it's import to specify the
92
  except Exception as e:
93
  results.append(f"\n## Error searching for {topic}: {str(e)}\n")
94
 
95
- if results:
96
- return "\n".join(results)
97
- else:
98
- return "No papers found for the given topics. Try different search terms."
99
 
100
  @tool
101
  def get_current_time_in_timezone(timezone: str) -> str:
 
13
  def paper_finder(topics:list, max_paper:int)-> str: #it's import to specify the return type
14
  #Keep this format for the description / args / args description but feel free to modify the tool
15
  """
16
+ Searches arxiv.org for the most recently updated research papers on specified topics.
17
+
18
+ This tool leverages the arXiv API to fetch the latest research papers based on their update dates.
19
+ For each topic provided, it returns up to `max_paper` number of papers. Each paper entry includes:
20
+ - **Title:** The paper's title.
21
+ - **Authors:** The names of the first three authors (an ellipsis is added if there are more).
22
+ - **Published Date:** The publication date (formatted as YYYY-MM-DD).
23
+ - **Summary:** A short, truncated summary of the paper.
24
+ - **PDF Link:** A direct link to the paper's PDF (if available).
25
+
26
+ **Args:**
27
+ topics (list): A list of topic keywords or phrases (e.g., ['Computer Vision', 'NLP']) to guide the search.
28
+ max_paper (int): The maximum number of papers to retrieve for each topic.
29
+
30
+ **Returns:**
31
+ str: A markdown-formatted string that summarizes the latest papers for each topic.
32
+ If an error occurs during the search for a topic, an error message will be included.
33
  """
34
 
35
  results = []
 
92
  except Exception as e:
93
  results.append(f"\n## Error searching for {topic}: {str(e)}\n")
94
 
95
+ return "\n".join(results) if results else "No papers found for the given topics. Try different search terms."
 
 
 
96
 
97
  @tool
98
  def get_current_time_in_timezone(timezone: str) -> str: