网站搜索工具
WebsiteSearchTool 目前处于实验阶段。我们正在积极努力将此工具整合到我们的产品套件中,并将相应地更新文档。
WebsiteSearchTool 被设计为一种在网站内容中进行语义搜索的概念。它旨在利用先进的机器学习模型,如检索增强生成(RAG),来高效地导航和提取指定 URL 的信息。该工具旨在提供灵活性,允许用户在任何网站上进行搜索,或专注于感兴趣的特定网站。请注意,WebsiteSearchTool 当前的实现细节仍在开发中,其描述的功能可能尚不可用。
为了在 WebsiteSearchTool 可用时做好环境准备,您可以使用以下命令安装基础包
pip install 'crewai[tools]'
此命令安装必要的依赖项,以确保一旦工具完全集成,用户可以立即开始使用。
用法示例
以下是 WebsiteSearchTool 在不同场景中如何使用的示例。请注意,这些示例仅为说明性,代表了计划中的功能。
from crewai_tools import WebsiteSearchTool
# Example of initiating tool that agents can use
# to search across any discovered websites
tool = WebsiteSearchTool()
# Example of limiting the search to the content of a specific website,
# so now agents can only search within that website
tool = WebsiteSearchTool(website='https://example.com')
website:一个可选参数,用于指定网站 URL 以进行重点搜索。此参数旨在通过允许在必要时进行有针对性的搜索来增强工具的灵活性。
自定义选项
默认情况下,该工具使用 OpenAI 进行嵌入和摘要。要自定义模型,您可以使用如下所示的配置字典:
tool = WebsiteSearchTool(
config=dict(
llm=dict(
provider="ollama", # or google, openai, anthropic, llama2, ...
config=dict(
model="llama2",
# temperature=0.5,
# top_p=1,
# stream=true,
),
),
embedder=dict(
provider="google", # or openai, ollama, ...
config=dict(
model="models/embedding-001",
task_type="retrieval_document",
# title="Embeddings",
),
),
)
)