Update tools.py
Browse files
tools.py
CHANGED
@@ -24,7 +24,7 @@ YOUTUBE_FRAME_ASSESSMENT_MODEL = os.getenv("YOUTUBE_FRAME_ASSESSMENT_MODEL", "go
|
|
24 |
YOUTUBE_CONFIRMATION_MODEL = os.getenv("YOUTUBE_CONFIRMATION_MODEL", "google/gemini-2.5-flash-preview-05-20")
|
25 |
|
26 |
# Define Tools for the Agent
|
27 |
-
@tool(parse_docstring=True)
|
28 |
def download_file_from_url(url: str, filename_override: str | None = None) -> str:
|
29 |
"""
|
30 |
Downloads a file from a URL to a directory in the cwd. Prefer to use the filename associated with the URL, but can override if directed to.
|
@@ -97,7 +97,7 @@ def download_file_from_url(url: str, filename_override: str | None = None) -> st
|
|
97 |
raise
|
98 |
# ValueError will propagate if raised
|
99 |
|
100 |
-
@tool(parse_docstring=True)
|
101 |
def basic_web_search(query: str, search_domains: list[str] | None = None) -> str:
|
102 |
"""
|
103 |
Perform a web search using Tavily. Useful for retrieving relevant URLs and content summaries based on a search query.
|
@@ -139,7 +139,7 @@ def basic_web_search(query: str, search_domains: list[str] | None = None) -> str
|
|
139 |
else:
|
140 |
return "No results found. If the query is too specific, try a more general search term."
|
141 |
|
142 |
-
@tool(parse_docstring=True)
|
143 |
def extract_url_content(url_list: list[str]) -> str:
|
144 |
"""
|
145 |
Extracts the content from URLs using Tavily's extract tool.
|
@@ -225,7 +225,7 @@ def get_table_title(table_tag):
|
|
225 |
|
226 |
return title
|
227 |
|
228 |
-
@tool(parse_docstring=True)
|
229 |
def wikipedia_reader(url: str) -> str:
|
230 |
"""
|
231 |
Extracts sections, paragraphs, and tables from a Wikipedia page.
|
@@ -324,7 +324,7 @@ class WhisperTranscriber:
|
|
324 |
return cls._instance
|
325 |
|
326 |
|
327 |
-
@tool(parse_docstring=True)
|
328 |
def transcribe_audio_file(file_path: str) -> str:
|
329 |
"""
|
330 |
Transcribes an audio file to text using OpenAI's Whisper-large-v3 model, caching the model after the first load.
|
@@ -338,7 +338,7 @@ def transcribe_audio_file(file_path: str) -> str:
|
|
338 |
return transcription.strip() if transcription else "No transcription available."
|
339 |
|
340 |
|
341 |
-
@tool(parse_docstring=True)
|
342 |
def question_youtube_video(video_url: str, query: str) -> str:
|
343 |
"""
|
344 |
Answers a question about a YouTube video.
|
|
|
24 |
YOUTUBE_CONFIRMATION_MODEL = os.getenv("YOUTUBE_CONFIRMATION_MODEL", "google/gemini-2.5-flash-preview-05-20")
|
25 |
|
26 |
# Define Tools for the Agent
|
27 |
+
@tool(parse_docstring=True, error_on_invalid_docstring=False)
|
28 |
def download_file_from_url(url: str, filename_override: str | None = None) -> str:
|
29 |
"""
|
30 |
Downloads a file from a URL to a directory in the cwd. Prefer to use the filename associated with the URL, but can override if directed to.
|
|
|
97 |
raise
|
98 |
# ValueError will propagate if raised
|
99 |
|
100 |
+
@tool(parse_docstring=True, error_on_invalid_docstring=False)
|
101 |
def basic_web_search(query: str, search_domains: list[str] | None = None) -> str:
|
102 |
"""
|
103 |
Perform a web search using Tavily. Useful for retrieving relevant URLs and content summaries based on a search query.
|
|
|
139 |
else:
|
140 |
return "No results found. If the query is too specific, try a more general search term."
|
141 |
|
142 |
+
@tool(parse_docstring=True, error_on_invalid_docstring=False)
|
143 |
def extract_url_content(url_list: list[str]) -> str:
|
144 |
"""
|
145 |
Extracts the content from URLs using Tavily's extract tool.
|
|
|
225 |
|
226 |
return title
|
227 |
|
228 |
+
@tool(parse_docstring=True, error_on_invalid_docstring=False)
|
229 |
def wikipedia_reader(url: str) -> str:
|
230 |
"""
|
231 |
Extracts sections, paragraphs, and tables from a Wikipedia page.
|
|
|
324 |
return cls._instance
|
325 |
|
326 |
|
327 |
+
@tool(parse_docstring=True, error_on_invalid_docstring=False)
|
328 |
def transcribe_audio_file(file_path: str) -> str:
|
329 |
"""
|
330 |
Transcribes an audio file to text using OpenAI's Whisper-large-v3 model, caching the model after the first load.
|
|
|
338 |
return transcription.strip() if transcription else "No transcription available."
|
339 |
|
340 |
|
341 |
+
@tool(parse_docstring=True, error_on_invalid_docstring=False)
|
342 |
def question_youtube_video(video_url: str, query: str) -> str:
|
343 |
"""
|
344 |
Answers a question about a YouTube video.
|