Skip to main content

YoutubeVideoSearchTool

We are still working on improving tools, so there might be unexpected behavior or changes in the future.

Description

This tool is part of the crewai_tools package and is designed to perform semantic searches within Youtube video content, utilizing Retrieval-Augmented Generation (RAG) techniques. It is one of several “Search” tools in the package that leverage RAG for different sources. The YoutubeVideoSearchTool allows for flexibility in searches; users can search across any Youtube video content without specifying a video URL, or they can target their search to a specific Youtube video by providing its URL.

Installation

To utilize the YoutubeVideoSearchTool, you must first install the crewai_tools package. This package contains the YoutubeVideoSearchTool among other utilities designed to enhance your data analysis and processing tasks. Install the package by executing the following command in your terminal:

Example

The following example demonstrates how to use the YoutubeVideoSearchTool with a CrewAI agent:
Code
You can also initialize the tool with a specific YouTube video URL:
Code

Parameters

The YoutubeVideoSearchTool accepts the following parameters:
  • youtube_video_url: Optional. The URL of the YouTube video to search within. If provided during initialization, the agent won’t need to specify it when using the tool.
  • config: Optional. Configuration for the underlying RAG system, including LLM and embedder settings.
  • summarize: Optional. Whether to summarize the retrieved content. Default is False.
When using the tool with an agent, the agent will need to provide:
  • search_query: Required. The search query to find relevant information in the video content.
  • youtube_video_url: Required only if not provided during initialization. The URL of the YouTube video to search within.

Custom Model and Embeddings

By default, the tool uses OpenAI for both embeddings and summarization. To customize the model, you can use a config dictionary as follows:
Code

Agent Integration Example

Here’s a more detailed example of how to integrate the YoutubeVideoSearchTool with a CrewAI agent:
Code

Implementation Details

The YoutubeVideoSearchTool is implemented as a subclass of RagTool, which provides the base functionality for Retrieval-Augmented Generation:
Code

Conclusion

The YoutubeVideoSearchTool provides a powerful way to search and extract information from YouTube video content using RAG techniques. By enabling agents to search within video content, it facilitates information extraction and analysis tasks that would otherwise be difficult to perform. This tool is particularly useful for research, content analysis, and knowledge extraction from video sources.