MDXSearchTool

MDXSearchTool 正在持续开发中。功能可能会增加或删除,并且随着我们对工具的完善,其功能可能会发生不可预测的变化。

描述

MDX 搜索工具是 crewai_tools 包的组成部分,旨在促进高级 markdown 语言提取。它使用基于查询的搜索,使用户能够有效地搜索和提取 MD 文件中的相关信息。该工具对于数据分析、信息管理和研究任务非常宝贵,简化了在大型文档集合中查找特定信息的流程。

安装

在使用 MDX 搜索工具之前,请确保已安装 crewai_tools 包。如果尚未安装,您可以使用以下命令安装:

pip install 'crewai[tools]'

使用示例

要使用 MDX 搜索工具,您必须首先设置必要的环境变量。然后,将该工具集成到您的 crewAI 项目中,开始进行市场研究。下面是一个基本示例,展示如何操作:

代码
from crewai_tools import MDXSearchTool

# Initialize the tool to search any MDX content it learns about during execution
tool = MDXSearchTool()

# OR

# Initialize the tool with a specific MDX file path for an exclusive search within that document
tool = MDXSearchTool(mdx='path/to/your/document.mdx')

参数

  • mdx: 可选。指定用于搜索的 MDX 文件路径。可以在初始化时提供。

模型和嵌入的自定义

该工具默认使用 OpenAI 进行嵌入和摘要。要进行自定义,请使用如下所示的配置字典:

代码
tool = MDXSearchTool(
    config=dict(
        llm=dict(
            provider="ollama", # Options include google, openai, anthropic, llama2, etc.
            config=dict(
                model="llama2",
                # Optional parameters can be included here.
                # 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",
                # Optional title for the embeddings can be added here.
                # title="Embeddings",
            ),
        ),
    )
)