mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-01-08 23:58:34 +00:00
- Update SerperDevTool documentation with accurate parameters and JSON response format - Enhance XMLSearchTool and MDXSearchTool docs with RAG capabilities and required parameters - Fix code block formatting across multiple tool documentation files - Add clarification about environment variables and configuration - Validate all examples against actual implementations - Successfully tested with mkdocs build Co-Authored-By: Joe Moura <joao@crewai.com>
79 lines
3.0 KiB
Plaintext
79 lines
3.0 KiB
Plaintext
---
|
|
title: MDX RAG Search
|
|
description: The `MDXSearchTool` is designed to search MDX files and return the most relevant results.
|
|
icon: markdown
|
|
---
|
|
|
|
# `MDXSearchTool`
|
|
|
|
<Note>
|
|
The MDXSearchTool is in continuous development. Features may be added or removed, and functionality could change unpredictably as we refine the tool.
|
|
</Note>
|
|
|
|
## Description
|
|
|
|
The MDX Search Tool is a component of the `crewai_tools` package aimed at facilitating advanced markdown language extraction. It enables users to effectively search and extract relevant information from MD files using query-based searches. This tool is invaluable for data analysis, information management, and research tasks, streamlining the process of finding specific information within large document collections.
|
|
|
|
## Installation
|
|
|
|
Before using the MDX Search Tool, ensure the `crewai_tools` package is installed. If it is not, you can install it with the following command:
|
|
|
|
```shell
|
|
pip install 'crewai[tools]'
|
|
```
|
|
|
|
## Example
|
|
|
|
To use the MDX Search Tool, you must first set up the necessary environment variables for your chosen LLM and embeddings providers (e.g., OpenAI API key if using the default configuration). Then, integrate the tool into your crewAI project as shown in the examples below.
|
|
|
|
The tool will perform semantic search using RAG technology to find and extract relevant content from your MDX files based on the search query:
|
|
|
|
```python
|
|
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')
|
|
```
|
|
|
|
## Parameters
|
|
|
|
- `mdx`: **Optional**. Specifies the MDX file path for the search. It can be provided during initialization or when running the search.
|
|
- `search_query`: **Required**. The query string to search for within the MDX content.
|
|
|
|
The tool inherits from `RagTool` which provides advanced RAG (Retrieval-Augmented Generation) capabilities for semantic search within MDX content.
|
|
|
|
## Customization of Model and Embeddings
|
|
|
|
The tool defaults to using OpenAI for embeddings and summarization. For customization, utilize a configuration dictionary as shown below:
|
|
|
|
```python
|
|
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",
|
|
),
|
|
),
|
|
)
|
|
)
|
|
```
|