跳转到主要内容

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-generativeai", # or openai, ollama, ...
            config=dict(
                model_name="gemini-embedding-001",
                task_type="RETRIEVAL_DOCUMENT",
                # title="Embeddings",
            ),
        ),
    )
)