I have defined a function for performing searches on the Google search engine. Here is the content of my function:
{
"name": "perform_google_search",
"description": "Perform a search on Google based on the user's query and return the raw search results.",
"parameters": {
"type": "object",
"properties": {
"query": {
"type": "string",
"description": "The user's search query to perform on Google."
}
},
"required": [
"query"
]
}
}
My API response is also quite simple, utilizing Google’s API google.cse.list
.
In general, most queries run successfully. However, I encountered an issue when asked to “please use Google search to find the official websites of these 50 products”.
Google search starts working, continuously searching for:
- Official website of product 1
- Official website of product 2
- Official website of product 3
- …
- Official website of product 50
This causes my thread to be stuck on Google search until it times out. How can I optimize this situation?