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
5 changes: 3 additions & 2 deletions docarray/document/mixins/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ def __rich_console__(self, console, options):
yield f":page_facing_up: [b]Document[/b]: [cyan]{self.id}[cyan]"
from rich.table import Table
from rich import box
from rich.text import Text

my_table = Table(
'Attribute', 'Value', width=80, box=box.ROUNDED, highlight=True
Expand All @@ -27,7 +28,7 @@ def __rich_console__(self, console, options):
continue
elif f in ('text', 'blob', 'uri') and len(getattr(self, f)) > 100:
v = getattr(self, f)
my_table.add_row(f, str(v)[:100] + f'... [dim](length: {len(v)})')
my_table.add_row(f, Text(str(v)[:100] + f'... [dim](length: {len(v)})'))
elif f in ('embedding', 'tensor'):
from docarray.math.ndarray import to_numpy_array

Expand All @@ -42,7 +43,7 @@ def __rich_console__(self, console, options):
v = f'{type(getattr(self, f))} in shape {v.shape}, dtype: {v.dtype}'
my_table.add_row(f, v)
elif f not in ('id', 'chunks', 'matches'):
my_table.add_row(f, str(getattr(self, f)))
my_table.add_row(f, Text(str(getattr(self, f))))
if my_table.rows:
yield my_table

Expand Down