Skip to content

Commit 5f1af3b

Browse files
committed
dump result in markdown format for news summarizer agent
1 parent 0d20f8b commit 5f1af3b

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

scripts/agent_operator.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,12 @@ def news_summarizer_agent(
136136
"-u",
137137
help="Comma-separated list of URLs to summarize",
138138
),
139+
output_file: str = typer.Option(
140+
"output.md",
141+
"--output-file",
142+
"-o",
143+
help="Path to the output Markdown file",
144+
),
139145
verbose: bool = typer.Option(
140146
False,
141147
"--verbose",
@@ -161,9 +167,12 @@ def news_summarizer_agent(
161167
logger.info("-" * 20)
162168
logger.info(f"Event: {event}")
163169

164-
articles: list[Article] = event["notify"]["articles"]
165-
for article in articles:
166-
logger.info(f"{article.structured_article.model_dump_json(indent=2)}")
170+
with open(output_file, "w", encoding="utf-8") as f:
171+
articles: list[Article] = event["notify"]["articles"]
172+
for article in articles:
173+
logger.info(f"{article.model_dump_json(indent=2)}")
174+
f.write(f"{article.model_dump_json(indent=2)}\n")
175+
f.write("\n---\n\n")
167176

168177

169178
@app.command()

0 commit comments

Comments
 (0)