LlamaIndex Tool
The LlamaIndexTool
is a wrapper for LlamaIndex tools and query engines.
LlamaIndexTool
Description
The LlamaIndexTool
is designed to be a general wrapper around LlamaIndex tools and query engines, enabling you to leverage LlamaIndex resources in terms of RAG/agentic pipelines as tools to plug into CrewAI agents. This tool allows you to seamlessly integrate LlamaIndex’s powerful data processing and retrieval capabilities into your CrewAI workflows.
Installation
To use this tool, you need to install LlamaIndex:
Steps to Get Started
To effectively use the LlamaIndexTool
, follow these steps:
- Install LlamaIndex: Install the LlamaIndex package using the command above.
- Set Up LlamaIndex: Follow the LlamaIndex documentation to set up a RAG/agent pipeline.
- Create a Tool or Query Engine: Create a LlamaIndex tool or query engine that you want to use with CrewAI.
Example
The following examples demonstrate how to initialize the tool from different LlamaIndex components:
From a LlamaIndex Tool
From LlamaHub Tools
From a LlamaIndex Query Engine
Class Methods
The LlamaIndexTool
provides two main class methods for creating instances:
from_tool
Creates a LlamaIndexTool
from a LlamaIndex tool.
from_query_engine
Creates a LlamaIndexTool
from a LlamaIndex query engine.
Parameters
The from_query_engine
method accepts the following parameters:
- query_engine: Required. The LlamaIndex query engine to wrap.
- name: Optional. The name of the tool.
- description: Optional. The description of the tool.
- return_direct: Optional. Whether to return the response directly. Default is
False
.
Conclusion
The LlamaIndexTool
provides a powerful way to integrate LlamaIndex’s capabilities into CrewAI agents. By wrapping LlamaIndex tools and query engines, it enables agents to leverage sophisticated data retrieval and processing functionalities, enhancing their ability to work with complex information sources.
Was this page helpful?