diff --git a/python/agents/podcast_transcript_agent/podcast_transcript_agent/__init__.py b/python/agents/podcast_transcript_agent/podcast_transcript_agent/__init__.py index 8ce90a27b..626296e25 100644 --- a/python/agents/podcast_transcript_agent/podcast_transcript_agent/__init__.py +++ b/python/agents/podcast_transcript_agent/podcast_transcript_agent/__init__.py @@ -12,5 +12,4 @@ # See the License for the specific language governing permissions and # limitations under the License. -from . import agent - +from . import agent # noqa: F401 diff --git a/python/agents/podcast_transcript_agent/podcast_transcript_agent/agent.py b/python/agents/podcast_transcript_agent/podcast_transcript_agent/agent.py index 1a5563516..0cdaccd96 100644 --- a/python/agents/podcast_transcript_agent/podcast_transcript_agent/agent.py +++ b/python/agents/podcast_transcript_agent/podcast_transcript_agent/agent.py @@ -13,8 +13,9 @@ # limitations under the License. from google.adk.agents import SequentialAgent -from .sub_agents.podcast_topics import podcast_topics_agent + from .sub_agents.podcast_episode_planner import podcast_episode_planner_agent +from .sub_agents.podcast_topics import podcast_topics_agent from .sub_agents.podcast_transcript_writer import ( podcast_transcript_writer_agent, ) diff --git a/python/agents/podcast_transcript_agent/podcast_transcript_agent/models/podcast_plan.py b/python/agents/podcast_transcript_agent/podcast_transcript_agent/models/podcast_plan.py index 1a8ceca70..e0154ccd6 100644 --- a/python/agents/podcast_transcript_agent/podcast_transcript_agent/models/podcast_plan.py +++ b/python/agents/podcast_transcript_agent/podcast_transcript_agent/models/podcast_plan.py @@ -13,16 +13,21 @@ # limitations under the License. from typing import List -from pydantic import BaseModel + from podcast_transcript_agent.models.podcast_transcript import PodcastSpeaker +from pydantic import BaseModel + class Segment(BaseModel): """A model for a 'main_segment', which includes a title.""" + title: str script_points: List[str] + class PodcastEpisodePlan(BaseModel): """Represents the entire episode, containing a title and a list of segments.""" + episode_title: str speakers: List[PodcastSpeaker] segments: List[Segment] diff --git a/python/agents/podcast_transcript_agent/podcast_transcript_agent/models/podcast_topics.py b/python/agents/podcast_transcript_agent/podcast_transcript_agent/models/podcast_topics.py index 62e6ed6f5..82b4eb88d 100644 --- a/python/agents/podcast_transcript_agent/podcast_transcript_agent/models/podcast_topics.py +++ b/python/agents/podcast_transcript_agent/podcast_transcript_agent/models/podcast_topics.py @@ -13,15 +13,20 @@ # limitations under the License. from typing import List + from pydantic import BaseModel + class Topic(BaseModel): """A model for a podcast topic, which includes a title, description, and key facts.""" + topic_name: str description: str key_facts: list[str] + class PodcastTopics(BaseModel): """A model for the main topic and sub-topics of a podcast episode.""" + main_topic: str sub_topics: List[Topic] diff --git a/python/agents/podcast_transcript_agent/podcast_transcript_agent/models/podcast_transcript.py b/python/agents/podcast_transcript_agent/podcast_transcript_agent/models/podcast_transcript.py index f92775cde..39fcf32e5 100644 --- a/python/agents/podcast_transcript_agent/podcast_transcript_agent/models/podcast_transcript.py +++ b/python/agents/podcast_transcript_agent/podcast_transcript_agent/models/podcast_transcript.py @@ -14,35 +14,46 @@ from typing import List + from pydantic import BaseModel + class SpeakerDialogue(BaseModel): """A model for a speaker's dialogue, including the speaker's ID and the text of the dialogue.""" + speaker_id: str text: str + class PodcastSegment(BaseModel): """A model for a podcast segment, which includes a title, start and end times of the segment (in seconds), and a list of speaker dialogues.""" + segment_title: str title: str start_time: float end_time: float speaker_dialogues: List[SpeakerDialogue] + class PodcastSpeaker(BaseModel): """A model for a podcast speaker, including their ID, name, and role.""" + speaker_id: str name: str role: str - + + class PodcastMetadata(BaseModel): """A model for the podcast's metadata, including the episode title, duration, and summary.""" + episode_title: str duration_seconds: int summary: str + class PodcastTranscript(BaseModel): """A model for a podcast transcript, which includes metadata, speakers, and segments.""" - metadata: PodcastMetadata + + metadata: PodcastMetadata speakers: List[PodcastSpeaker] - segments: List[PodcastSegment] \ No newline at end of file + segments: List[PodcastSegment] diff --git a/python/agents/podcast_transcript_agent/podcast_transcript_agent/sub_agents/podcast_episode_planner/__init__.py b/python/agents/podcast_transcript_agent/podcast_transcript_agent/sub_agents/podcast_episode_planner/__init__.py index ff4d1c9e5..5887755a4 100644 --- a/python/agents/podcast_transcript_agent/podcast_transcript_agent/sub_agents/podcast_episode_planner/__init__.py +++ b/python/agents/podcast_transcript_agent/podcast_transcript_agent/sub_agents/podcast_episode_planner/__init__.py @@ -12,5 +12,4 @@ # See the License for the specific language governing permissions and # limitations under the License. -from .agent import podcast_episode_planner_agent - +from .agent import podcast_episode_planner_agent # noqa: F401 diff --git a/python/agents/podcast_transcript_agent/podcast_transcript_agent/sub_agents/podcast_episode_planner/agent.py b/python/agents/podcast_transcript_agent/podcast_transcript_agent/sub_agents/podcast_episode_planner/agent.py index 083144cd1..f3ad118ac 100644 --- a/python/agents/podcast_transcript_agent/podcast_transcript_agent/sub_agents/podcast_episode_planner/agent.py +++ b/python/agents/podcast_transcript_agent/podcast_transcript_agent/sub_agents/podcast_episode_planner/agent.py @@ -13,9 +13,9 @@ # limitations under the License. from google.adk.agents import Agent -from . import prompt from podcast_transcript_agent.models.podcast_plan import PodcastEpisodePlan +from . import prompt podcast_episode_planner_agent = Agent( name="podcast_episode_planner_agent", @@ -23,5 +23,5 @@ description="Plans the podcast episode based on extracted topics", instruction=prompt.PODCAST_EPISODE_PLANNER_PROMPT, output_schema=PodcastEpisodePlan, - output_key="podcast_episode_plan" -) \ No newline at end of file + output_key="podcast_episode_plan", +) diff --git a/python/agents/podcast_transcript_agent/podcast_transcript_agent/sub_agents/podcast_topics/__init__.py b/python/agents/podcast_transcript_agent/podcast_transcript_agent/sub_agents/podcast_topics/__init__.py index 0c0288112..beb5e68f4 100644 --- a/python/agents/podcast_transcript_agent/podcast_transcript_agent/sub_agents/podcast_topics/__init__.py +++ b/python/agents/podcast_transcript_agent/podcast_transcript_agent/sub_agents/podcast_topics/__init__.py @@ -12,7 +12,4 @@ # See the License for the specific language governing permissions and # limitations under the License. -from .agent import podcast_topics_agent - - - +from .agent import podcast_topics_agent # noqa: F401 diff --git a/python/agents/podcast_transcript_agent/podcast_transcript_agent/sub_agents/podcast_topics/agent.py b/python/agents/podcast_transcript_agent/podcast_transcript_agent/sub_agents/podcast_topics/agent.py index 9887f9708..9072051ec 100644 --- a/python/agents/podcast_transcript_agent/podcast_transcript_agent/sub_agents/podcast_topics/agent.py +++ b/python/agents/podcast_transcript_agent/podcast_transcript_agent/sub_agents/podcast_topics/agent.py @@ -13,14 +13,15 @@ # limitations under the License. from google.adk.agents import Agent -from . import prompt from podcast_transcript_agent.models.podcast_topics import PodcastTopics +from . import prompt + podcast_topics_agent = Agent( name="podcast_topics_agent", model="gemini-2.5-flash", description="Extracts podcast topics from provided input", - instruction= prompt.TOPIC_EXTRACTION_PROMPT, + instruction=prompt.TOPIC_EXTRACTION_PROMPT, output_schema=PodcastTopics, - output_key="podcast_topics" + output_key="podcast_topics", ) diff --git a/python/agents/podcast_transcript_agent/podcast_transcript_agent/sub_agents/podcast_transcript_writer/__init__.py b/python/agents/podcast_transcript_agent/podcast_transcript_agent/sub_agents/podcast_transcript_writer/__init__.py index 539f1cea3..c99122a2f 100644 --- a/python/agents/podcast_transcript_agent/podcast_transcript_agent/sub_agents/podcast_transcript_writer/__init__.py +++ b/python/agents/podcast_transcript_agent/podcast_transcript_agent/sub_agents/podcast_transcript_writer/__init__.py @@ -12,6 +12,4 @@ # See the License for the specific language governing permissions and # limitations under the License. -from .agent import podcast_transcript_writer_agent - - +from .agent import podcast_transcript_writer_agent # noqa: F401 diff --git a/python/agents/podcast_transcript_agent/podcast_transcript_agent/sub_agents/podcast_transcript_writer/agent.py b/python/agents/podcast_transcript_agent/podcast_transcript_agent/sub_agents/podcast_transcript_writer/agent.py index 35cd80dd3..1bbf7da14 100644 --- a/python/agents/podcast_transcript_agent/podcast_transcript_agent/sub_agents/podcast_transcript_writer/agent.py +++ b/python/agents/podcast_transcript_agent/podcast_transcript_agent/sub_agents/podcast_transcript_writer/agent.py @@ -13,15 +13,15 @@ # limitations under the License. from google.adk.agents import Agent -from . import prompt from podcast_transcript_agent.models.podcast_transcript import PodcastTranscript -podcast_transcript_writer_agent = Agent( +from . import prompt + +podcast_transcript_writer_agent = Agent( name="podcast_transcript_writer_agent", model="gemini-2.5-flash", description="Writes the podcast transcript based on the podcast plan", instruction=prompt.PODCAST_TRANSCRIPT_WRITER_PROMPT, output_schema=PodcastTranscript, - output_key="podcast_episode_transcript" - ) - + output_key="podcast_episode_transcript", +) diff --git a/python/agents/podcast_transcript_agent/tests/test_agents.py b/python/agents/podcast_transcript_agent/tests/test_agents.py index 135504430..c8355b31c 100644 --- a/python/agents/podcast_transcript_agent/tests/test_agents.py +++ b/python/agents/podcast_transcript_agent/tests/test_agents.py @@ -12,13 +12,14 @@ # See the License for the specific language governing permissions and # limitations under the License. +import json +from pathlib import Path + +import dotenv import pytest from google.adk.runners import InMemoryRunner -from podcast_transcript_agent.agent import podcast_transcript_agent -from pathlib import Path from google.genai import types -import dotenv -import json +from podcast_transcript_agent.agent import podcast_transcript_agent @pytest.fixture(scope="session", autouse=True)