liamgh commited on
Commit
72c71dc
·
verified ·
1 Parent(s): e9617cd

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -3
app.py CHANGED
@@ -4,6 +4,7 @@ import requests
4
  import pytz
5
  import yaml
6
  from tools.final_answer import FinalAnswerTool
 
7
 
8
  from Gradio_UI import GradioUI
9
 
@@ -11,12 +12,12 @@ from Gradio_UI import GradioUI
11
  @tool
12
  def get_books_by_subject(subject:str, published_in:str)-> str: #it's import to specify the return type
13
  #Keep this format for the description / args / args description but feel free to modify the tool
14
- """A tool that fetches books from the OpenLibrary based on a given subject
15
- Args (both must be URL-encoded):
16
  subject: A string representing the subject (e.g. 'love', 'cars', 'Girls Aloud')
17
  published_in: A date range for the publication of the book. This is optional. (e.g. "1500-1600", "1980-1989", "")
18
  """
19
- r = requets.get("https://openlibrary.org/subjects/%s.json?pubished_in=%s" % (subject, published_in))
20
  return r.json()
21
 
22
  @tool
 
4
  import pytz
5
  import yaml
6
  from tools.final_answer import FinalAnswerTool
7
+ from urllib.parse import quote
8
 
9
  from Gradio_UI import GradioUI
10
 
 
12
  @tool
13
  def get_books_by_subject(subject:str, published_in:str)-> 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
+ """A tool that fetches books from the OpenLibrary based on a given keyword.
16
+ Args:
17
  subject: A string representing the subject (e.g. 'love', 'cars', 'Girls Aloud')
18
  published_in: A date range for the publication of the book. This is optional. (e.g. "1500-1600", "1980-1989", "")
19
  """
20
+ r = requests.get("https://openlibrary.org/subjects/%s.json?pubished_in=%s" % (quote(subject), quote(published_in)))
21
  return r.json()
22
 
23
  @tool