Skip to content

Commit 4a20cb2

Browse files
authored
Merge pull request #172 from georgian-io/fix_table_display_non_str
Fixed issue where Rich cannot display non-str types
2 parents bf691d8 + bc07848 commit 4a20cb2

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

llmtune/utils/rich_print_utils.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,15 @@ def inject_example_to_rich_layout(layout: Layout, layout_name: str, example: dic
2828
formatted = example.pop("formatted_prompt", None)
2929
formatted_text = Text(formatted)
3030

31+
print(example)
3132
for key, c in zip(example.keys(), colors):
3233
table.add_column(key, style=c)
3334

34-
tgt_text = example[key]
35+
tgt_text = str(example[key])
3536
start_idx = formatted.find(tgt_text)
3637
formatted_text.stylize(f"bold {c}", start_idx, start_idx + len(tgt_text))
3738

38-
table.add_row(*example.values())
39+
table.add_row(*[str(v) for v in example.values()])
3940

4041
layout.split_column(
4142
Layout(

0 commit comments

Comments
 (0)