Skip to content
CrewAI 文档版本 跟随上游 源快照 02692df3 更新于 2026-10-18

网站 RAG 搜索

WebsiteSearchTool 旨在对网站内容执行 RAG(检索增强生成)搜索。

WebsiteSearchTool

NOTE

WebsiteSearchTool 目前处于实验阶段。我们正在积极将该工具纳入我们的产品套件中,并将相应更新文档。

描述

WebsiteSearchTool 的构想是在网站内容中执行语义搜索。 它旨在利用检索增强生成(RAG)等先进机器学习模型,高效地浏览并提取指定 URL 中的信息。 该工具意在提供灵活性,让用户可以在任意网站上执行搜索,或聚焦于特定的感兴趣网站。 请注意,WebsiteSearchTool 当前的实现细节仍在开发中,其所描述的功能可能尚不可用。

安装

为在 WebsiteSearchTool 可用时准备好你的环境,你可以安装基础包:

shell
pip install 'crewai[tools]'

该命令会安装必要的依赖,以确保工具完全集成后用户可以立即开始使用。

用法示例

以下是 WebsiteSearchTool 在不同场景中可用方式的示例。请注意,这些示例仅作说明,代表的是计划中的功能:

python
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 进行嵌入和摘要。要自定义模型,你可以使用如下配置字典:

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

BytesRouter 是社区翻译站点,所有译文仅供参考,一切以官方英文原文为准。