@@ -65,20 +65,17 @@ def message_buffer_handler(**kwargs):
65
65
@tool
66
66
def search_for_fashion_books (query , filters = None ) -> str :
67
67
"""
68
- Get detailed information about fashion books from Open Library.
68
+ Search for detailed information about fashion books using the Open Library API .
69
69
70
70
Args:
71
- query: The search query for fashion books.
72
- filters: Optional filters to apply to the search results, including title, author, or year.
71
+ query: The search term to look up fashion-related books.
73
72
74
73
Returns:
75
- A string containing the list of books found from the search .
74
+ A string summarizing the list of matching books, or a message if none are found .
76
75
"""
77
- def replace_spaces_with_plus (s ):
78
- return s .replace (' ' , '+' )
79
76
80
77
# Replace spaces in the query with plus signs for URL encoding
81
- clean_query = replace_spaces_with_plus ( query )
78
+ clean_query = query . replace ( ' ' , '+' )
82
79
83
80
url = f"https://openlibrary.org/search.json"
84
81
headers = {}
@@ -89,14 +86,6 @@ def replace_spaces_with_plus(s):
89
86
"limit" : 10
90
87
}
91
88
92
- if filters :
93
- if "title" in filters :
94
- params ["title" ] = filters ["title" ]
95
- if "author" in filters :
96
- params ["author" ] = filters ["author" ]
97
- if "year" in filters :
98
- params ["year" ] = filters ["year" ]
99
-
100
89
try :
101
90
response = requests .get (url , headers = headers , params = params )
102
91
if response .ok :
@@ -126,20 +115,6 @@ def replace_spaces_with_plus(s):
126
115
"query" : {
127
116
"type" : "string" ,
128
117
"description" : "Search query for fashion books" ,
129
- },
130
- "filters" : {
131
- "title" : {
132
- "type" : "string" ,
133
- "description" : "Filter by book title"
134
- },
135
- "author" : {
136
- "type" : "string" ,
137
- "description" : "Filter by author name"
138
- },
139
- "year" : {
140
- "type" : "integer" ,
141
- "description" : "Filter by publication year"
142
- }
143
118
}
144
119
},
145
120
"required" : ["query" ],
0 commit comments