Merge pull request #470 from PengZa666/improve-peer-agent-readme

修复了Google搜索工具文档中的拼写错误:"serpher" → "serper" 改进了代码注释,添加了详细的docstring
This commit is contained in:
Jerry Z H
2025-10-22 16:22:14 +08:00
committed by GitHub
15 changed files with 33 additions and 25 deletions

View File

@@ -19,7 +19,7 @@ class GoogleSearchTool(Tool):
Implement the execute method of demo google search tool, using the `GoogleSerperAPIWrapper` to implement a simple Google search.
Note:
You need to sign up for a free account at https://serper.dev and get the serpher api key (2500 free queries).
You need to sign up for a free account at https://serper.dev and get the serper api key (2500 free queries).
"""
serper_api_key: Optional[str] = Field(default_factory=lambda: get_from_env("SERPER_API_KEY"))

View File

@@ -61,7 +61,7 @@ class GoogleSearchTool(Tool):
Implement the execute method of demo google search tool, using the `GoogleSerperAPIWrapper` to implement a simple Google search.
Note:
You need to sign up for a free account at https://serper.dev and get the serpher api key (2500 free queries).
You need to sign up for a free account at https://serper.dev and get the serper api key (2500 free queries).
"""
def execute(self, tool_input: ToolInput):

View File

@@ -61,7 +61,7 @@ class GoogleSearchTool(Tool):
Implement the execute method of demo google search tool, using the `GoogleSerperAPIWrapper` to implement a simple Google search.
Note:
You need to sign up for a free account at https://serper.dev and get the serpher api key (2500 free queries).
You need to sign up for a free account at https://serper.dev and get the serper api key (2500 free queries).
"""
def execute(self, input: str):

View File

@@ -18,7 +18,7 @@ class GoogleSearchTool(Tool):
Implement the execute method of demo google search tool, using the `GoogleSerperAPIWrapper` to implement a simple Google search.
Note:
You need to sign up for a free account at https://serper.dev and get the serpher api key (2500 free queries).
You need to sign up for a free account at https://serper.dev and get the serper api key (2500 free queries).
"""
serper_api_key: Optional[str] = Field(default_factory=lambda: get_from_env("SERPER_API_KEY"))
@@ -26,4 +26,4 @@ class GoogleSearchTool(Tool):
def execute(self, input: str):
# get top10 results from Google search.
search = GoogleSerperAPIWrapper(serper_api_key=self.serper_api_key, k=10, gl="us", hl="en", type="search")
return search.run(query=input)
return search.run(query=input)

View File

@@ -19,7 +19,7 @@ class GoogleSearchTool(Tool):
Implement the execute method of demo google search tool, using the `GoogleSerperAPIWrapper` to implement a simple Google search.
Note:
You need to sign up for a free account at https://serper.dev and get the serpher api key (2500 free queries).
You need to sign up for a free account at https://serper.dev and get the serper api key (2500 free queries).
"""
serper_api_key: Optional[str] = Field(default_factory=lambda: get_from_env("SERPER_API_KEY"))

View File

@@ -17,7 +17,7 @@ class GoogleSearchTool(Tool):
Implement the execute method of demo google search tool, using the `GoogleSerperAPIWrapper` to implement a simple Google search.
Note:
You need to sign up for a free account at https://serper.dev and get the serpher api key (2500 free queries).
You need to sign up for a free account at https://serper.dev and get the serper api key (2500 free queries).
"""
serper_api_key: Optional[str] = Field(default_factory=lambda: get_from_env("SERPER_API_KEY"))
@@ -25,4 +25,4 @@ class GoogleSearchTool(Tool):
def execute(self, input: str):
# get top10 results from Google search.
search = GoogleSerperAPIWrapper(serper_api_key=self.serper_api_key, k=10, gl="us", hl="en", type="search")
return search.run(query=input)
return search.run(query=input)

View File

@@ -19,7 +19,7 @@ class GoogleSearchTool(Tool):
Implement the execute method of demo google search tool, using the `GoogleSerperAPIWrapper` to implement a simple Google search.
Note:
You need to sign up for a free account at https://serper.dev and get the serpher api key (2500 free queries).
You need to sign up for a free account at https://serper.dev and get the serper api key (2500 free queries).
"""
serper_api_key: Optional[str] = Field(default_factory=lambda: get_from_env("SERPER_API_KEY"))

View File

@@ -17,7 +17,7 @@ class GoogleSearchTool(Tool):
Implement the execute method of demo google search tool, using the `GoogleSerperAPIWrapper` to implement a simple Google search.
Note:
You need to sign up for a free account at https://serper.dev and get the serpher api key (2500 free queries).
You need to sign up for a free account at https://serper.dev and get the serper api key (2500 free queries).
"""
serper_api_key: Optional[str] = Field(default_factory=lambda: get_from_env("SERPER_API_KEY"))
@@ -25,4 +25,4 @@ class GoogleSearchTool(Tool):
def execute(self, input: str):
# get top10 results from Google search.
search = GoogleSerperAPIWrapper(serper_api_key=self.serper_api_key, k=10, gl="us", hl="en", type="search")
return search.run(query=input)
return search.run(query=input)

View File

@@ -17,12 +17,20 @@ class GoogleSearchTool(Tool):
Implement the execute method of demo google search tool, using the `GoogleSerperAPIWrapper` to implement a simple Google search.
Note:
You need to sign up for a free account at https://serper.dev and get the serpher api key (2500 free queries).
You need to sign up for a free account at https://serper.dev and get the serper api key (2500 free queries).
"""
serper_api_key: Optional[str] = Field(default_factory=lambda: get_from_env("SERPER_API_KEY"))
def execute(self, input: str):
# get top10 results from Google search.
"""Execute Google search and return top 10 results.
Args:
input (str): The search query string
Returns:
str: Search results from Google in text format
"""
# Configure Google search with top 10 results, US region, English language
search = GoogleSerperAPIWrapper(serper_api_key=self.serper_api_key, k=10, gl="us", hl="en", type="search")
return search.run(query=input)
return search.run(query=input)

View File

@@ -17,7 +17,7 @@ class GoogleSearchTool(Tool):
Implement the execute method of demo google search tool, using the `GoogleSerperAPIWrapper` to implement a simple Google search.
Note:
You need to sign up for a free account at https://serper.dev and get the serpher api key (2500 free queries).
You need to sign up for a free account at https://serper.dev and get the serper api key (2500 free queries).
"""
serper_api_key: Optional[str] = Field(default_factory=lambda: get_from_env("SERPER_API_KEY"))
@@ -25,4 +25,4 @@ class GoogleSearchTool(Tool):
def execute(self, input: str):
# get top10 results from Google search.
search = GoogleSerperAPIWrapper(serper_api_key=self.serper_api_key, k=10, gl="us", hl="en", type="search")
return search.run(query=input)
return search.run(query=input)

View File

@@ -17,7 +17,7 @@ class GoogleSearchTool(Tool):
Implement the execute method of demo google search tool, using the `GoogleSerperAPIWrapper` to implement a simple Google search.
Note:
You need to sign up for a free account at https://serper.dev and get the serpher api key (2500 free queries).
You need to sign up for a free account at https://serper.dev and get the serper api key (2500 free queries).
"""
serper_api_key: Optional[str] = Field(default_factory=lambda: get_from_env("SERPER_API_KEY"))
@@ -25,4 +25,4 @@ class GoogleSearchTool(Tool):
def execute(self, input: str):
# get top10 results from Google search.
search = GoogleSerperAPIWrapper(serper_api_key=self.serper_api_key, k=10, gl="us", hl="en", type="search")
return search.run(query=input)
return search.run(query=input)

View File

@@ -18,7 +18,7 @@ class GoogleSearchTool(Tool):
Implement the execute method of demo google search tool, using the `GoogleSerperAPIWrapper` to implement a simple Google search.
Note:
You need to sign up for a free account at https://serper.dev and get the serpher api key (2500 free queries).
You need to sign up for a free account at https://serper.dev and get the serper api key (2500 free queries).
"""
serper_api_key: Optional[str] = Field(default_factory=lambda: get_from_env("SERPER_API_KEY"))
@@ -26,4 +26,4 @@ class GoogleSearchTool(Tool):
def execute(self, input: str):
# get top10 results from Google search.
search = GoogleSerperAPIWrapper(serper_api_key=self.serper_api_key, k=10, gl="us", hl="en", type="search")
return search.run(query=input)
return search.run(query=input)

View File

@@ -17,7 +17,7 @@ class GoogleSearchTool(Tool):
Implement the execute method of demo google search tool, using the `GoogleSerperAPIWrapper` to implement a simple Google search.
Note:
You need to sign up for a free account at https://serper.dev and get the serpher api key (2500 free queries).
You need to sign up for a free account at https://serper.dev and get the serper api key (2500 free queries).
"""
serper_api_key: Optional[str] = Field(default_factory=lambda: get_from_env("SERPER_API_KEY"))
@@ -25,4 +25,4 @@ class GoogleSearchTool(Tool):
def execute(self, input: str):
# get top10 results from Google search.
search = GoogleSerperAPIWrapper(serper_api_key=self.serper_api_key, k=10, gl="us", hl="en", type="search")
return search.run(query=input)
return search.run(query=input)

View File

@@ -19,7 +19,7 @@ class DemoSearchTool(Tool):
Implement the execute method of demo google search tool, using the `GoogleSerperAPIWrapper` to implement a simple Google search.
Note:
You need to sign up for a free account at https://serper.dev and get the serpher api key (2500 free queries).
You need to sign up for a free account at https://serper.dev and get the serper api key (2500 free queries).
"""
serper_api_key: Optional[str] = Field(default_factory=lambda: get_from_env("SERPER_API_KEY"))

View File

@@ -19,7 +19,7 @@ class GoogleSearchTool(Tool):
Implement the execute method of demo google search tool, using the `GoogleSerperAPIWrapper` to implement a simple Google search.
Note:
You need to sign up for a free account at https://serper.dev and get the serpher api key (2500 free queries).
You need to sign up for a free account at https://serper.dev and get the serper api key (2500 free queries).
"""
serper_api_key: Optional[str] = Field(default_factory=lambda: get_from_env("SERPER_API_KEY"))
@@ -27,4 +27,4 @@ class GoogleSearchTool(Tool):
def execute(self, input: str):
# get top10 results from Google search.
search = GoogleSerperAPIWrapper(serper_api_key=self.serper_api_key, k=10, gl="us", hl="en", type="search")
return search.run(query=input)
return search.run(query=input)