I have a challenge while using Gemini with the YouTube Channel RAG Search. Any help and guidance is highly appreciated

I did configure the YouTube Channel RAG Search to work with gemini. Here is the code:
from crewai_tools import YoutubeChannelSearchTool

Initialize the tool with a specific YouTube channel handle

youtube_channel_tool = YoutubeChannelSearchTool(
config=dict(
llm=dict(
provider=“google”, # or google, openai, anthropic, llama2, …
config=dict(
model=“gemini/gemini-1.5-flash”,

        ),
    ),
    embedder=dict(
        provider="google", # or openai, ollama, ...
        config=dict(
            model="models/embedding-001",
            
            
        ),
    ),
),
youtube_channel_handle='@CircleCI-Videos',

)
But now everytime i try running the crew i get this error:
Running the Crew
C:\Users\AJIKA ANGELO\Desktop\multi_agent.venv\Lib\site-packages\pydantic_internal_generate_schema.py:623: UserWarning: is not a Python type (it may be an instance of an object), Pydantic will allow any object with no validation since we cannot even enforce that the input is an instance of the given type. To get rid of this error wrap the type with pydantic.SkipValidation.
warn(
Traceback (most recent call last):
File “”, line 198, in _run_module_as_main
File “”, line 88, in run_code
File "C:\Users\AJIKA ANGELO\Desktop\multi_agent.venv\Scripts\run_crew.exe_main
.py", line 4, in
File “C:\Users\AJIKA ANGELO\Desktop\multi_agent\src\multi_agent\main.py”, line 7, in
from multi_agent.crew import MultiAgent
File “C:\Users\AJIKA ANGELO\Desktop\multi_agent\src\multi_agent\crew.py”, line 8, in
youtube_channel_tool = YoutubeChannelSearchTool(
^^^^^^^^^^^^^^^^^^^^^^^^^
File “C:\Users\AJIKA ANGELO\Desktop\multi_agent.venv\Lib\site-packages\crewai_tools\tools\youtube_channel_search_tool\youtube_channel_search_tool.py”, line 32, in
init
super().init(**kwargs)
File “C:\Users\AJIKA ANGELO\Desktop\multi_agent.venv\Lib\site-packages\pydantic\main.py”, line 253, in init
validated_self = self.pydantic_validator.validate_python(data, self_instance=self)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “C:\Users\AJIKA ANGELO\Desktop\multi_agent.venv\Lib\site-packages\crewai_tools\tools\rag\rag_tool.py”, line 45, in set_default_adapter
app = App.from_config(config=self.config) if self.config else App()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “C:\Users\AJIKA ANGELO\Desktop\multi_agent.venv\Lib\site-packages\embedchain\app.py”, line 393, in from_config
llm = LlmFactory.create(llm_provider, llm_config_data.get(“config”, {}))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “C:\Users\AJIKA ANGELO\Desktop\multi_agent.venv\Lib\site-packages\embedchain\factory.py”, line 44, in create
llm_class = load_class(class_type)
^^^^^^^^^^^^^^^^^^^^^^
File “C:\Users\AJIKA ANGELO\Desktop\multi_agent.venv\Lib\site-packages\embedchain\factory.py”, line 6, in load_class
module = importlib.import_module(module_path)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\AJIKA ANGELO\AppData\Local\Programs\Python\Python311\Lib\importlib_init
.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “C:\Users\AJIKA ANGELO\Desktop\multi_agent.venv\Lib\site-packages\embedchain\llm\google.py”, line 9, in
raise ImportError(“GoogleLlm requires extra dependencies. Install with pip install google-generativeai”) from None
ImportError: GoogleLlm requires extra dependencies. Install with pip install google-generativeai
An error occurred while running the crew: Command ‘[‘uv’, ‘run’, ‘run_crew’]’ returned non-zero exit status 1.
I went further an tried installing google-generativeai using pip but the error is still persistent

Hey Ajika,

Just wanted to reply so you’re not left hanging, and also so this can serve as a reference for anyone else running into issues with YoutubeChannelSearchTool or YoutubeVideoSearchTool. Heads up – they’re broken right now!

Since it looks like from your example you were interested in testing out the YoutubeChannelSearchTool to search the @CircleCI-Videos YouTube channel using Google models, here’s a full example to really nail down how you’d typically set up the tool correctly (even though it won’t work at the moment):

import os
from crewai import Agent, Crew, LLM, Process, Task
from crewai_tools import YoutubeChannelSearchTool

# Set your Gemini API key (used by LiteLLM for the LLM)
os.environ["GEMINI_API_KEY"] = "YOUR_KEY"
# Set your Google API key (used by Embedchain for embeddings)
os.environ["GOOGLE_API_KEY"] = os.environ["GEMINI_API_KEY"]

embedchain_config = {
    "embedder": {
        "provider": "google",
        "config": {
            "model": "models/text-embedding-004",
            "task_type": "RETRIEVAL_DOCUMENT"
        }
    }
}

youtube_search_tool = YoutubeChannelSearchTool(
    youtube_channel_handle="@CircleCI-Videos",
    config=embedchain_config
)

gemini_llm = LLM(
    model="gemini/gemini-2.5-flash-preview-04-17",
    temperature=0.3
)

blog_researcher_agent = Agent(
    role="Blog Creator from Youtube Videos",
    goal=(
        "Get the relevant video content for the given topic "
        "from youtube channel"
    ),
    backstory=(
        "Expert in understanding videos in crime, fun and entertainment "
        "and providing suggestion"
    ),
    tools=[youtube_search_tool],
    allow_delegation=False,
    verbose=False,
    llm=gemini_llm
)

blog_writer_agent = Agent(
    role="Blog Writer from Youtube Videos",
    goal=(
        "Narrate compelling blog content from the video content for "
        "the given topic"
    ),
    backstory=(
        "With a flair for simplifying complex topics, you craft engaging "
        "narratives that captivate and educate, bringing new discoveries "
        "to light in an accessible manner."
    ),
    tools=[youtube_search_tool],
    allow_delegation=False,
    verbose=False,
    llm=gemini_llm
)

research_task = Task(
    description=(
        "Identify the video '{topic}'. "
        "Get detailed information about the video from the channel"
    ),
    expected_output=(
        "A comprehensive 3 paragraphs long report based on "
        "'{topic}' of video content"
    ),
    agent=blog_researcher_agent
)

writing_task = Task(
    description=(
        "Get the info from the youtube channel on topic '{topic}'."
    ),
    expected_output=(
        "Summarize the info from youtube channel video on the topic "
        "'{topic}' and create the content for the blog"
    ),
    agent=blog_writer_agent
)

blog_crew = Crew(
    agents=[blog_researcher_agent, blog_writer_agent],
    tasks=[research_task, writing_task],
    process=Process.sequential,
    verbose=True
)

result = blog_crew.kickoff(
    inputs={"topic": "7 tips for effective system prompting"}
)

print(f"\n🤖 Final Report:\n\n{result.raw}")

Like I mentioned, this code isn’t actually going to run because the RAG tool itself is busted. As you probably know, CrewAI’s RAG tools use the Embedchain library under the hood by default. And Embedchain itself is having trouble adding YouTube channels (or even single videos) as a data source right now. The issue seems to stem from the pytube library, which Embedchain relies on for YouTube scraping.

Here’s some simpler code using just Embedchain that shows even trying to add a single video throws an error:

from embedchain import App
import os

os.environ["GOOGLE_API_KEY"] = "YOUR_KEY"

embedchain_config = {
    "embedder": {
        "provider": "google",
        "config": {
            "model": "models/text-embedding-004",
            "task_type": "RETRIEVAL_DOCUMENT"
        }
    }
}

app = App.from_config(config=embedchain_config)

app.add("https://www.youtube.com/watch?v=MvzmUdMg7wg", data_type="youtube_video")

result = app.search("7 tips for effective system prompting")

print(result)

Finally, just a heads-up: even if the code worked, that @CircleCI-Videos channel has over 400 videos. When Embedchain tries to scrape all of them to build its index, you’d probably get your IP blocked by YouTube pretty quickly for excessive requests (happened to me!). So, keep that potential issue in mind for when the tools are fixed.

1 Like