[x] I searched existing ideas and did not find a similar one
[x] I added a very descriptive title
[x] I've clearly described the feature request and motivation for it
Feature Request
We propose adding a new tool that integrates the YouTube Data API (YouTube Search API) into Langchain. This can take a query from an agent, use the YouTube Search API to gather relevant video information, format the information into a readable output, and return the result to the agent. The integration will support the ReAct pattern by allowing the LLM to decide when to invoke the YouTube search tool during reasoning steps.
Sample Usage
from langchain.agents import initialize_agent, Tool
from langchain.llms import OpenAI
from langchain_community.tools.youtube_search import YouTubeSearchTool
# Initialize the YouTube Search tool
youtube_tool = YouTubeSearchTool()
tools = [
Tool(
name="YouTube Search",
func=youtube_tool.run,
description="Useful for searching YouTube for videos related to a query.",
),
]
llm = OpenAI(temperature=0)
agent = initialize_agent(tools, llm, agent="zero-shot-react-description", verbose=True)
agent_response = agent.run("Find me tutorials on Python programming.")
print(agent_response)
Sample Output
> Entering new AgentExecutor chain...
I need to find tutorials on Python programming on YouTube.
Thought: I should use the YouTube Search tool to find relevant videos.
Action: YouTube Search
Action Input: "Python programming tutorials"
Observation:
Here are some YouTube videos related to "Python programming tutorials":
1. **Python Tutorial for Beginners [Full Course] Learn Python for Web Development** by Programming with Mosh
- **Duration:** 6:14:07
- **Views:** 15,234,567
- **Published:** Jan 1, 2021
- **Description:** This complete Python tutorial covers everything you need to know to start programming in Python.
2. **Learn Python - Full Course for Beginners** by freeCodeCamp.org
- **Duration:** 4:26:52
- **Views:** 10,987,654
- **Published:** Dec 12, 2020
- **Description:** This comprehensive course covers Python programming basics to advanced concepts.
3. **Python Object-Oriented Programming (OOP) for Beginners** by Corey Schafer
- **Duration:** 1:30:45
- **Views:** 2,345,678
- **Published:** Mar 15, 2021
- **Description:** Learn the fundamentals of object-oriented programming in Python.
Thought: Now I can provide the user with these video tutorials.
Final Answer: Here are some Python programming tutorials I found on YouTube:
1. **Python Tutorial for Beginners [Full Course] Learn Python for Web Development** by Programming with Mosh
2. **Learn Python - Full Course for Beginners** by freeCodeCamp.org
3. **Python Object-Oriented Programming (OOP) for Beginners** by Corey Schafer
> Finished chain.
Motivation
There are various API integrations for useful tasks, and we would like to expand it for an agent to be able to search through YouTube videos using the official API (https://developers.google.com/youtube/v3/docs/search) for enhanced responses and querying capabilities.
Proposal
We plan to open a PR to add a new tool that allows access to the YouTube Search API (https://developers.google.com/youtube/v3/docs/search), which will allow the agent to access YouTube search results and information about the corresponding video, channel, and playlists. This can be extended with the other YouTube APIs to fetch information about the transcript, comment section, and in-depth channel information.
Hey thanks for taking the initiative! Although, this is part of a University of Toronto proposal (should be assigned to utoronto), so we do plan to complete this.
Checked
Feature Request
We propose adding a new tool that integrates the YouTube Data API (YouTube Search API) into Langchain. This can take a query from an agent, use the YouTube Search API to gather relevant video information, format the information into a readable output, and return the result to the agent. The integration will support the ReAct pattern by allowing the LLM to decide when to invoke the YouTube search tool during reasoning steps.
Sample Usage
Sample Output
Motivation
There are various API integrations for useful tasks, and we would like to expand it for an agent to be able to search through YouTube videos using the official API (https://developers.google.com/youtube/v3/docs/search) for enhanced responses and querying capabilities.
Proposal
We plan to open a PR to add a new tool that allows access to the YouTube Search API (https://developers.google.com/youtube/v3/docs/search), which will allow the agent to access YouTube search results and information about the corresponding video, channel, and playlists. This can be extended with the other YouTube APIs to fetch information about the transcript, comment section, and in-depth channel information.