WebsiteSearchTool

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",
            ),
        ),
    )
)