mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-01-10 16:48:30 +00:00
Merge pull request #18 from jeroen-vet/jeroen-vet-patch-1
Update serper_dev_tool.py consider n_results parameter
This commit is contained in:
@@ -12,17 +12,17 @@ class SerperDevToolSchema(BaseModel):
|
||||
|
||||
class SerperDevTool(BaseTool):
|
||||
name: str = "Search the internet"
|
||||
description: str = "A tool that can be used to search the internet."
|
||||
description: str = "A tool that can be used to search the internet with a search_query."
|
||||
args_schema: Type[BaseModel] = SerperDevToolSchema
|
||||
search_url: str = "https://google.serper.dev/search"
|
||||
n_results: int = None
|
||||
n_results: int = 10
|
||||
|
||||
def _run(
|
||||
self,
|
||||
search_query: str,
|
||||
**kwargs: Any,
|
||||
) -> Any:
|
||||
payload = json.dumps({"q": search_query})
|
||||
payload = json.dumps({"q": search_query, "num": self.n_results})
|
||||
headers = {
|
||||
'X-API-KEY': os.environ['SERPER_API_KEY'],
|
||||
'content-type': 'application/json'
|
||||
|
||||
Reference in New Issue
Block a user