Matty-Sam commited on
Commit
6ad46e3
·
verified ·
1 Parent(s): 8589303

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -3
app.py CHANGED
@@ -36,19 +36,20 @@ def get_current_time_in_timezone(timezone: str) -> str:
36
  return f"Error fetching time for timezone '{timezone}': {str(e)}"
37
 
38
  @tool
39
- def search_for_books(author: str = '', title: str = '') -> str:
40
  """A tool that searches for books by author keywords or words in the title of the book
41
  Args:
42
  author: A string representing an authors name.
43
  title: A string representing a book title.
 
 
44
  """
45
 
46
  if not author and not title:
47
  return 'Must provide at least one of author or title.'
48
 
49
  try:
50
- search_terms = ' '.join([author, title])
51
- params = {"search": search_terms}
52
  base_url = 'https://gutendex.com/books'
53
  response = requests.get(base_url, params=params)
54
 
 
36
  return f"Error fetching time for timezone '{timezone}': {str(e)}"
37
 
38
  @tool
39
+ def search_for_books(author: str = '') -> str:
40
  """A tool that searches for books by author keywords or words in the title of the book
41
  Args:
42
  author: A string representing an authors name.
43
  title: A string representing a book title.
44
+ Returns:
45
+ List of dictionaries. Each list item is a book and dictionaries ahve keys 'title', 'authors', 'subjects', and 'summaries'
46
  """
47
 
48
  if not author and not title:
49
  return 'Must provide at least one of author or title.'
50
 
51
  try:
52
+ params = {"search": author}
 
53
  base_url = 'https://gutendex.com/books'
54
  response = requests.get(base_url, params=params)
55