TypeError: ScriptGenerator.init() takes 1 positional argument but 2 were given.
result: Iterator[RunResponse] = pd_generator.run(topic = topic)
TypeError: ScriptGenerator.init() takes 1 positional argument but 2 were given.
result: Iterator[RunResponse] = pd_generator.run(topic = topic)
Hey @Monkey.D.Luffy
Thanks for reaching out and for using Agno! I’ve looped in the right engineers to help with your question. We usually respond within 24 hours, but if this is urgent, just let us know, and we’ll do our best to prioritize it.
Appreciate your patience—we’ll get back to you soon!
Hi @Monkey.D.Luffy can you explain a bit more or give some code snippets?
What’s your Agent config.
Hey kaustubh, sure here’s the code.
CODE:
from typing import List, Iterator
from textwrap import dedent
from dotenv import load_dotenv
from agno.agent import Agent
from agno.models.openai import OpenAIChat
from agno.tools.googlesearch import GoogleSearchTools
from agno.workflow import Workflow, RunEvent, RunResponse
from agno.utils.log import logger
from agno.utils.pprint import pprint_run_response
from pydantic import BaseModel, Field
from rich.prompt import Prompt
import random
load_dotenv()
class PodcastInput(BaseModel):
topic: str
class SearchResults(BaseModel):
urls: List[str]
snippets: List[str]
titles: List[str]
class ScriptGenerator(Workflow):
description: str = dedent(“”"
An intelligent podcast script generator that creates engaging, well-researched audio content.
This workflow orchestrates multiple AI agents to research, analyze, and craft
compelling podcast scripts that combine journalistic rigor with captivating storytelling.
“”")
def init(self):
self.searcher = Agent(
model=OpenAIChat(id=“gpt-4o-mini”),
tools=[GoogleSearchTools()],
description=dedent(“”"
You are PodcastResearch-X, an elite research assistant specializing in discovering high-quality sources for engaging podcast content. Your expertise includes:
self.writer = Agent(
model=OpenAIChat(id=“gpt-4o-mini”),
description=dedent(“”"
You are PodcastScript-X, an elite scriptwriting assistant specializing in crafting engaging and dynamic podcast scripts based on research provided by PodcastResearch-X. Your expertise includes:
def run(self, topic: str) → Iterator[RunResponse]:
search_results = self.searcher.run(topic, stream=True)
if not isinstance(search_results, Iterator):
search_results = iter([search_results])
search_results_text = “”
for resp in search_results:
if hasattr(resp, “output”) and resp.output:
logger.info(f"Searcher output chunk: {resp.output}")
search_results_text += resp.output
script_text = “”
for resp in self.writer.run(search_results_text, stream=True):
if hasattr(resp, “output”) and resp.output:
logger.info(f"Writer output chunk: {resp.output}")
script_text += resp.output
if not script_text:
script_text = “No script generated.”
yield RunResponse(content=script_text)
if name == “main”:
topic = Prompt.ask(“Enter a topic for the podcast”)
logger.info(f"Generating podcast script for topic: {topic}")
pd_generator = ScriptGenerator()
result = pd_generator.run(topic)
pprint_run_response(result)
Error is the same, mentioned in the message.
The last output i got was this,
INFO Generating podcast script for topic: Indian Independence Movement
│ No script generated. │