主题
SerpApi Google Shopping 工具
SerpApiGoogleShoppingTool使用 SerpApi 搜索 Google Shopping 结果。
SerpApiGoogleShoppingTool
描述
利用 SerpApiGoogleShoppingTool 通过 SerpApi 查询 Google Shopping 并检索面向产品的结果。
安装
shell
uv add crewai-tools[serpapi]环境变量
SERPAPI_API_KEY(必填):SerpApi 的 API 密钥。在 https://serpapi.com/ 创建一个(提供免费套餐)。
示例
python
from crewai import Agent, Task, Crew
from crewai_tools import SerpApiGoogleShoppingTool
tool = SerpApiGoogleShoppingTool()
agent = Agent(
role="Shopping Researcher",
goal="Find relevant products",
backstory="Expert in product search",
tools=[tool],
verbose=True,
)
task = Task(
description="Search Google Shopping for 'wireless noise-canceling headphones'",
expected_output="Top relevant products with titles and links",
agent=agent,
)
crew = Crew(agents=[agent], tasks=[task])
result = crew.kickoff()说明
- 在环境中设置
SERPAPI_API_KEY。在 https://serpapi.com/ 创建密钥 - 另请参阅通过 SerpApi 进行 Google 网页搜索:
/en/tools/search-research/serpapi-googlesearchtool
参数
运行参数
search_query(str,必填):产品搜索查询。location(str,可选):地理位置参数。