Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions nemoguardrails/logging/verbose.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,9 @@ def emit(self, record) -> None:
skip_print = True
if verbose_llm_calls:
console.print("")
console.print(f"[cyan]LLM {title} ({record.id[:5]}..)[/]")
id_str = getattr(record, "id", None)
id_display = f"({id_str[:5]}..)" if id_str else ""
console.print(f"[cyan]LLM {title} {id_display}[/]")
for line in body.split("\n"):
text = Text(line, style="black on #006600", end="\n")
text.pad_right(console.width)
Expand All @@ -66,9 +68,10 @@ def emit(self, record) -> None:
if verbose_llm_calls:
skip_print = True
console.print("")
console.print(
f"[cyan]LLM Prompt ({record.id[:5]}..) - {record.task}[/]"
)
id_str = getattr(record, "id", None)
id_display = f"({id_str[:5]}..)" if id_str else ""
task_str = getattr(record, "task", "unknown")
console.print(f"[cyan]LLM Prompt {id_display} - {task_str}[/]")

for line in body.split("\n"):
if line.strip() == "[/]":
Expand Down