Skip to content

Commit f4ada22

Browse files
authored
Format final story outline for better readability using textwrap
Problem: The final story outline was printed as a single unformatted block, making it hard to read for multi-line or lengthy content. Changes: - Added `textwrap` import to enable line-based formatting. - Replaced `print(f"Final story outline: {latest_outline}")` with: ```python print("Final story outline:") print(textwrap.indent(latest_outline, " ")) ``` - Ensures each line of the outline is indented by 2 spaces for visual clarity. Benefits: - Improves readability of multi-line outputs. - Keeps the outline distinct from surrounding console logs. - Safe to use since `latest_outline` is guaranteed to be a string before printing (set in the loop).
1 parent eafd8df commit f4ada22

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

examples/agent_patterns/llm_as_a_judge.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from __future__ import annotations
22

3+
import textwrap
34
import asyncio
45
from dataclasses import dataclass
56
from typing import Literal
@@ -69,7 +70,8 @@ async def main() -> None:
6970

7071
input_items.append({"content": f"Feedback: {result.feedback}", "role": "user"})
7172

72-
print(f"Final story outline: {latest_outline}")
73+
print("Final story outline:")
74+
print(textwrap.indent(latest_outline, " "))
7375

7476

7577
if __name__ == "__main__":

0 commit comments

Comments
 (0)