Skip to content

Commit a99f66e

Browse files
committed
remove filter fields
1 parent 15b8a50 commit a99f66e

File tree

1 file changed

+4
-29
lines changed

1 file changed

+4
-29
lines changed

samples/agentic-strands/app/agent.py

Lines changed: 4 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -65,20 +65,17 @@ def message_buffer_handler(**kwargs):
6565
@tool
6666
def search_for_fashion_books(query, filters=None) -> str:
6767
"""
68-
Get detailed information about fashion books from Open Library.
68+
Search for detailed information about fashion books using the Open Library API.
6969
7070
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.
7372
7473
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.
7675
"""
77-
def replace_spaces_with_plus(s):
78-
return s.replace(' ', '+')
7976

8077
# Replace spaces in the query with plus signs for URL encoding
81-
clean_query = replace_spaces_with_plus(query)
78+
clean_query = query.replace(' ', '+')
8279

8380
url = f"https://openlibrary.org/search.json"
8481
headers = {}
@@ -89,14 +86,6 @@ def replace_spaces_with_plus(s):
8986
"limit": 10
9087
}
9188

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-
10089
try:
10190
response = requests.get(url, headers=headers, params=params)
10291
if response.ok:
@@ -126,20 +115,6 @@ def replace_spaces_with_plus(s):
126115
"query": {
127116
"type": "string",
128117
"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-
}
143118
}
144119
},
145120
"required": ["query"],

0 commit comments

Comments
 (0)