Web Tools
Web-based tools for search, scraping, and content extraction.
rllm.tools.web_tools
FirecrawlTool
Bases: Tool
A tool for extracting data from websites using the FireCrawl service.
Source code in rllm/tools/web_tools/firecrawl_tool.py
__init__
Initialize the Firecrawl tool.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
timeout
|
int
|
Maximum time in seconds to wait for scraping results. |
TIMEOUT
|
api_key
|
str
|
API key for FireCrawl service. |
FIRECRAWL_API_KEY
|
api_url
|
str
|
Custom API URL endpoint. |
None
|
Source code in rllm/tools/web_tools/firecrawl_tool.py
forward
Run firecrawl job asynchronously.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
url
|
str
|
The URL to scrape. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
ToolOutput |
ToolOutput
|
An object containing either the scraped content or an error message. |
Source code in rllm/tools/web_tools/firecrawl_tool.py
async_forward
async
Asynchronous version of the forward method.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
url
|
str
|
The URL to scrape. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
ToolOutput |
ToolOutput
|
An object containing either the scraped content or an error message. |
Source code in rllm/tools/web_tools/firecrawl_tool.py
GoogleSearchTool
Bases: Tool
A tool for searching google.
Source code in rllm/tools/web_tools/gsearch_tool.py
__init__
__init__(name: str = NAME, description: str = DESCRIPTION, timeout: float = DEFAULT_SEARCH_ENGINE_TIMEOUT, reference_count: int = REFERENCE_COUNT)
Initialize the GoogleSearch tool.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The name of the tool, defaults to GoogleSearch.NAME. |
NAME
|
description
|
str
|
A description of the tool's purpose, defaults to GoogleSearch.DESCRIPTION. |
DESCRIPTION
|
timeout
|
float
|
Maximum time in seconds to wait for search results, defaults to DEFAULT_SEARCH_ENGINE_TIMEOUT. |
DEFAULT_SEARCH_ENGINE_TIMEOUT
|
reference_count
|
int
|
Number of results to return, defaults to REFERENCE_COUNT. |
REFERENCE_COUNT
|
Source code in rllm/tools/web_tools/gsearch_tool.py
forward
Execute a Google search with the given query.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
query
|
str
|
Query to be submitted to Google search engine. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
ToolOutput |
ToolOutput
|
An object containing either the search results or an error message. |
Source code in rllm/tools/web_tools/gsearch_tool.py
TavilyExtractTool
Bases: Tool
A tool for extracting data from websites.
Source code in rllm/tools/web_tools/tavily_tool.py
forward
Extract content from provided URLs using Tavily API.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
urls
|
List[str]
|
List of URLs to extract content from. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
ToolOutput |
ToolOutput
|
An object containing either the extracted content or an error message. |
Source code in rllm/tools/web_tools/tavily_tool.py
TavilySearchTool
Bases: Tool
A tool for searching the web using Tavily API.
Source code in rllm/tools/web_tools/tavily_tool.py
forward
forward(query: str, search_depth: str = 'basic', include_domains: list[str] | None = None, exclude_domains: list[str] | None = None, max_results: int = 5) -> ToolOutput
Search the web using Tavily API.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
query
|
str
|
The search query. |
required |
search_depth
|
str
|
The depth of search. Defaults to "basic". |
'basic'
|
include_domains
|
List[str]
|
List of domains to include in the search. |
None
|
exclude_domains
|
List[str]
|
List of domains to exclude from the search. |
None
|
max_results
|
int
|
Maximum number of search results to return. Defaults to 5. |
5
|
Returns:
| Name | Type | Description |
|---|---|---|
ToolOutput |
ToolOutput
|
An object containing either the search results or an error message. |