File tree Expand file tree Collapse file tree 1 file changed +12
-3
lines changed Expand file tree Collapse file tree 1 file changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -136,6 +136,12 @@ def news_summarizer_agent(
136
136
"-u" ,
137
137
help = "Comma-separated list of URLs to summarize" ,
138
138
),
139
+ output_file : str = typer .Option (
140
+ "output.md" ,
141
+ "--output-file" ,
142
+ "-o" ,
143
+ help = "Path to the output Markdown file" ,
144
+ ),
139
145
verbose : bool = typer .Option (
140
146
False ,
141
147
"--verbose" ,
@@ -161,9 +167,12 @@ def news_summarizer_agent(
161
167
logger .info ("-" * 20 )
162
168
logger .info (f"Event: { event } " )
163
169
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 " )
167
176
168
177
169
178
@app .command ()
You can’t perform that action at this time.
0 commit comments