Markiian Tsalyk
commited on
Commit
·
783d369
1
Parent(s):
8eea4d3
New transcript tool
Browse files- __pycache__/tools.cpython-313.pyc +0 -0
- requirements.txt +2 -1
- tools.py +5 -4
__pycache__/tools.cpython-313.pyc
CHANGED
Binary files a/__pycache__/tools.cpython-313.pyc and b/__pycache__/tools.cpython-313.pyc differ
|
|
requirements.txt
CHANGED
@@ -12,4 +12,5 @@ llama-index-llms-openrouter
|
|
12 |
wikipedia
|
13 |
youtube-transcript-api
|
14 |
python-dotenv
|
15 |
-
openpyxl
|
|
|
|
12 |
wikipedia
|
13 |
youtube-transcript-api
|
14 |
python-dotenv
|
15 |
+
openpyxl
|
16 |
+
supadata
|
tools.py
CHANGED
@@ -1,5 +1,6 @@
|
|
1 |
from smolagents import DuckDuckGoSearchTool, GoogleSearchTool
|
2 |
from youtube_transcript_api import YouTubeTranscriptApi
|
|
|
3 |
import wikipedia
|
4 |
from wikipedia_tables_parser import fetch_wikipedia_tables
|
5 |
import pandas as pd
|
@@ -21,6 +22,7 @@ llm = OpenRouter(
|
|
21 |
model="google/gemini-2.5-flash-preview",
|
22 |
temperature=0.7,
|
23 |
)
|
|
|
24 |
|
25 |
|
26 |
def reverse_text(text: str, **kwargs) -> str:
|
@@ -254,7 +256,7 @@ def execute_python_file(file_path: str) -> Any:
|
|
254 |
del sys.modules[module_name]
|
255 |
|
256 |
|
257 |
-
def trascript_youtube(video_id: str, **kwargs) ->
|
258 |
"""
|
259 |
Returns transcript of YouTube video.
|
260 |
|
@@ -264,10 +266,9 @@ def trascript_youtube(video_id: str, **kwargs) -> list:
|
|
264 |
Return:
|
265 |
Transcript of YouTube video.
|
266 |
"""
|
267 |
-
|
268 |
-
result = ytt_api.fetch(video_id)
|
269 |
|
270 |
-
return
|
271 |
|
272 |
|
273 |
def read_excel(path: str, **kwargs) -> pd.DataFrame:
|
|
|
1 |
from smolagents import DuckDuckGoSearchTool, GoogleSearchTool
|
2 |
from youtube_transcript_api import YouTubeTranscriptApi
|
3 |
+
from supadata import Supadata, SupadataError
|
4 |
import wikipedia
|
5 |
from wikipedia_tables_parser import fetch_wikipedia_tables
|
6 |
import pandas as pd
|
|
|
22 |
model="google/gemini-2.5-flash-preview",
|
23 |
temperature=0.7,
|
24 |
)
|
25 |
+
supadata = Supadata(api_key=os.getenv("SUPADATA_API_KEY"))
|
26 |
|
27 |
|
28 |
def reverse_text(text: str, **kwargs) -> str:
|
|
|
256 |
del sys.modules[module_name]
|
257 |
|
258 |
|
259 |
+
def trascript_youtube(video_id: str, **kwargs) -> str:
|
260 |
"""
|
261 |
Returns transcript of YouTube video.
|
262 |
|
|
|
266 |
Return:
|
267 |
Transcript of YouTube video.
|
268 |
"""
|
269 |
+
transcript = supadata.youtube.transcript(video_id=video_id, lang="en")
|
|
|
270 |
|
271 |
+
return transcript.content
|
272 |
|
273 |
|
274 |
def read_excel(path: str, **kwargs) -> pd.DataFrame:
|