mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-06-28 02:53:30 +00:00
Add model describe subcommand
This commit is contained in:
parent
9d7f283722
commit
45b8a7ffcd
3 changed files with 77 additions and 6 deletions
|
@ -22,7 +22,6 @@ def format_row(row, col_widths):
|
|||
if line.strip() == "":
|
||||
lines.append("")
|
||||
else:
|
||||
line = line.strip()
|
||||
lines.extend(
|
||||
textwrap.wrap(
|
||||
line, width, break_long_words=False, replace_whitespace=False
|
||||
|
@ -45,14 +44,18 @@ def format_row(row, col_widths):
|
|||
|
||||
|
||||
def print_table(rows, headers=None, separate_rows: bool = False):
|
||||
def itemlen(item):
|
||||
return len(strip_ansi_colors(item))
|
||||
|
||||
rows = [[x or "" for x in row] for row in rows]
|
||||
if not headers:
|
||||
col_widths = [
|
||||
max(len(strip_ansi_colors(item)) for item in col) for col in zip(*rows)
|
||||
]
|
||||
col_widths = [max(itemlen(item) for item in col) for col in zip(*rows)]
|
||||
else:
|
||||
col_widths = [
|
||||
max(len(header), max(len(strip_ansi_colors(item)) for item in col))
|
||||
max(
|
||||
itemlen(header),
|
||||
max(itemlen(item) for item in col),
|
||||
)
|
||||
for header, col in zip(headers, zip(*rows))
|
||||
]
|
||||
col_widths = [min(w, 80) for w in col_widths]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue