WebsiteSearchTool

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

描述

WebsiteSearchTool 被设计为一个概念,用于在网站内容中进行语义搜索。 它旨在利用先进的机器学习模型,如检索增强生成(RAG),高效地从指定的URL中导航和提取信息。 该工具旨在提供灵活性,允许用户在任何网站上进行搜索或专注于感兴趣的特定网站。 请注意,WebsiteSearchTool 的当前实现细节正在开发中,所描述的功能可能尚不可用。

安装

为了在WebsiteSearchTool可用时准备您的环境,您可以通过以下方式安装基础包:

pip install 'crewai[tools]'

此命令安装必要的依赖项,以确保一旦工具完全集成,用户可以立即开始使用它。

示例用法

以下是WebsiteSearchTool在不同场景中如何使用的示例。请注意,这些示例是说明性的,代表了计划中的功能:

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

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

这个页面有帮助吗?