Spaces:
Sleeping
Sleeping
remove analyze_transcript as not needed
Browse files
app.py
CHANGED
@@ -453,28 +453,28 @@ def get_youtube_transcript(video_id: str, language: str = "en") -> str:
|
|
453 |
return f"Error retrieving transcript: {str(e)}"
|
454 |
|
455 |
# Tool to analyze the transcript and answer a question
|
456 |
-
@tool
|
457 |
-
def analyze_transcript(transcript: str, question: str) -> str:
|
458 |
-
|
459 |
-
|
460 |
|
461 |
-
|
462 |
-
|
463 |
-
|
464 |
|
465 |
-
|
466 |
-
|
467 |
-
|
468 |
-
|
469 |
-
|
470 |
-
|
471 |
-
|
472 |
|
473 |
-
|
474 |
-
|
475 |
-
|
476 |
|
477 |
-
|
478 |
|
479 |
|
480 |
|
@@ -599,7 +599,7 @@ class BasicAgent:
|
|
599 |
self.youtube_qa_agent = ToolCallingAgent(
|
600 |
model=reasoning_model, #self.model,
|
601 |
tools=[extract_youtube_id, get_youtube_transcript,
|
602 |
-
|
603 |
name="youtube_qa_agent",
|
604 |
planning_interval=2,
|
605 |
max_steps=5,
|
@@ -610,9 +610,8 @@ class BasicAgent:
|
|
610 |
When given a YouTube URL and a question, follow these steps IN ORDER:
|
611 |
1. Extract the video ID from the URL using the `extract_youtube_id` tool
|
612 |
2. Retrieve the transcript of the video using the `get_youtube_transcript` tool
|
613 |
-
3.
|
614 |
-
4.
|
615 |
-
5. Return your final answer using the `final_answer` tool
|
616 |
|
617 |
IMPORTANT INSTRUCTIONS:
|
618 |
- After getting the transcript, you MUST use the analyze_transcript tool. DO NOT call get_youtube_transcript twice.
|
|
|
453 |
return f"Error retrieving transcript: {str(e)}"
|
454 |
|
455 |
# Tool to analyze the transcript and answer a question
|
456 |
+
# @tool
|
457 |
+
# def analyze_transcript(transcript: str, question: str) -> str:
|
458 |
+
# """
|
459 |
+
# Analyze the provided video transcript to answer a specific question.
|
460 |
|
461 |
+
# Args:
|
462 |
+
# transcript: The full transcript text of the video
|
463 |
+
# question: The specific question to answer based on the transcript
|
464 |
|
465 |
+
# Returns:
|
466 |
+
# The answer to the question based on the transcript content
|
467 |
+
# """
|
468 |
+
# # This tool leverages the LLM's understanding capability
|
469 |
+
# # The implementation is simple because the LLM will do the analysis
|
470 |
+
# if not transcript or transcript.startswith("Error"):
|
471 |
+
# return f"Unable to analyze transcript: {transcript}"
|
472 |
|
473 |
+
# # Check if transcript has enough content to analyze
|
474 |
+
# if len(transcript.split()) < 10:
|
475 |
+
# return "The transcript is too short or incomplete to properly analyze."
|
476 |
|
477 |
+
# return "TRANSCRIPT_ANALYSIS_PLACEHOLDER" # This will be replaced by LLM reasoning
|
478 |
|
479 |
|
480 |
|
|
|
599 |
self.youtube_qa_agent = ToolCallingAgent(
|
600 |
model=reasoning_model, #self.model,
|
601 |
tools=[extract_youtube_id, get_youtube_transcript,
|
602 |
+
FinalAnswerTool()],
|
603 |
name="youtube_qa_agent",
|
604 |
planning_interval=2,
|
605 |
max_steps=5,
|
|
|
610 |
When given a YouTube URL and a question, follow these steps IN ORDER:
|
611 |
1. Extract the video ID from the URL using the `extract_youtube_id` tool
|
612 |
2. Retrieve the transcript of the video using the `get_youtube_transcript` tool
|
613 |
+
3. Provide a clear and concise answer based solely on the transcript content
|
614 |
+
4. Return your final answer using the `final_answer` tool
|
|
|
615 |
|
616 |
IMPORTANT INSTRUCTIONS:
|
617 |
- After getting the transcript, you MUST use the analyze_transcript tool. DO NOT call get_youtube_transcript twice.
|