tu101 commited on
Commit
c53f8d7
·
verified ·
1 Parent(s): 90c43c0
Files changed (1) hide show
  1. tools.py +18 -4
tools.py CHANGED
@@ -23,12 +23,28 @@ from langchain_community.document_loaders import YoutubeLoader
23
  from langchain_community.document_loaders import AssemblyAIAudioTranscriptLoader
24
  from langchain_community.document_loaders.assemblyai import TranscriptFormat
25
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
26
 
27
  def audio_search(path: str) -> str:
28
- """Read an audio mp3 file and extract the text to understand it.
29
 
30
  Args:
31
- path: The path to the file. If the file is just {name}.mp3, then it is local, and just use {name}.mp3. """
32
  aai.settings.api_key = "945f7d6c00f142158322cd0c13901024"
33
  audio_file = "./"+path
34
  loader = AssemblyAIAudioTranscriptLoader(file_path=audio_file, transcript_format=TranscriptFormat.PARAGRAPHS)
@@ -48,8 +64,6 @@ audio_search_tool = Tool(
48
  )
49
 
50
 
51
-
52
-
53
  def excel_search(excel_path: str ) -> str:
54
  """Given the path to an excel file, return the excel file contents as raw text.
55
 
 
23
  from langchain_community.document_loaders import AssemblyAIAudioTranscriptLoader
24
  from langchain_community.document_loaders.assemblyai import TranscriptFormat
25
 
26
+ def YT_search(link: str) -> str:
27
+ """Finds the specified YouTube video and reads the transcript for the video.
28
+
29
+ Args:
30
+ link: The URL to the YouTube video that must be transcripted and searched."""
31
+ loader = YoutubeLoader.from_youtube_url(
32
+ "https://www.youtube.com/watch?v=QsYGlZkevEg", add_video_info=True)
33
+ YT_Transcript = loader.load()
34
+ return {"YT_docs": YT_Transcript}
35
+
36
+ YT_search_tool = Tool(
37
+ name="YT_search",
38
+ func=YT_search,
39
+ description="Finds a specified YouTube video and reads the transcript for the video to be searched by the LLM."
40
+ )
41
+
42
 
43
  def audio_search(path: str) -> str:
44
+ """Read an audio mp3 file and extract the text to understand it.
45
 
46
  Args:
47
+ path: The path to the file. If the file attached is just {name}.mp3, then it is local, and just use {name}.mp3. """
48
  aai.settings.api_key = "945f7d6c00f142158322cd0c13901024"
49
  audio_file = "./"+path
50
  loader = AssemblyAIAudioTranscriptLoader(file_path=audio_file, transcript_format=TranscriptFormat.PARAGRAPHS)
 
64
  )
65
 
66
 
 
 
67
  def excel_search(excel_path: str ) -> str:
68
  """Given the path to an excel file, return the excel file contents as raw text.
69