kylea commited on
Commit
0a81a06
·
1 Parent(s): 61f69c3

bug fix for book search tool

Browse files
Files changed (1) hide show
  1. tools/book_search.py +3 -3
tools/book_search.py CHANGED
@@ -33,7 +33,7 @@ class NYTBestSellerTool(Tool):
33
  'genre':
34
  {'type': 'string', 'description': 'The genre to search'},
35
  'limit':
36
- {'type': 'string', 'description': 'The number of results to include', 'nullable': True}
37
  }
38
  output_type = "string"
39
 
@@ -62,7 +62,7 @@ class NYTBestSellerTool(Tool):
62
  "young-adult-paperback-monthly"
63
  ]
64
 
65
- def forward(self, genre: str, limit: str = "5") -> str:
66
  if isinstance(limit,str):
67
  limit = int(limit)
68
 
@@ -75,7 +75,7 @@ class NYTBestSellerTool(Tool):
75
  f"https://api.nytimes.com/svc/books/v3/lists/{genre}.json",
76
  params={"api-key":self.api_key}
77
  )
78
- if len(result.status_code) != 200:
79
  raise Exception("Error getting the best seller list. Please try again later.")
80
 
81
  book_results = result.json()['results']['books']
 
33
  'genre':
34
  {'type': 'string', 'description': 'The genre to search'},
35
  'limit':
36
+ {'type': 'integer', 'description': 'The number of results to include', 'nullable': True}
37
  }
38
  output_type = "string"
39
 
 
62
  "young-adult-paperback-monthly"
63
  ]
64
 
65
+ def forward(self, genre: str, limit: int = 5) -> str:
66
  if isinstance(limit,str):
67
  limit = int(limit)
68
 
 
75
  f"https://api.nytimes.com/svc/books/v3/lists/{genre}.json",
76
  params={"api-key":self.api_key}
77
  )
78
+ if result.status_code != 200:
79
  raise Exception("Error getting the best seller list. Please try again later.")
80
 
81
  book_results = result.json()['results']['books']