diff --git a/llm/cli.py b/llm/cli.py index f78840de..e0c8e47c 100644 --- a/llm/cli.py +++ b/llm/cli.py @@ -1022,7 +1022,7 @@ def logs_list( json.loads(row["token_details"]) if row["token_details"] else None, ) if token_usage: - click.echo("## Token usage:\n\n{}".format(token_usage)) + click.echo("## Token usage:\n\n{}\n".format(token_usage)) @cli.group( diff --git a/tests/test_llm.py b/tests/test_llm.py index 49795ca2..b83ff842 100644 --- a/tests/test_llm.py +++ b/tests/test_llm.py @@ -69,7 +69,7 @@ def test_logs_text(log_path, usage): "system\n\n" "## Response:\n\n" "response\n\n" - ) + ("## Token usage:\n\n2 input, 5 output\n" if usage else "") + ( + ) + ("## Token usage:\n\n2 input, 5 output\n\n" if usage else "") + ( "# YYYY-MM-DDTHH:MM:SS conversation: abc123\n\n" "Model: **davinci**\n\n" "## Prompt:\n\n" @@ -77,7 +77,7 @@ def test_logs_text(log_path, usage): "## Response:\n\n" "response\n\n" ) + ( - "## Token usage:\n\n2 input, 5 output\n" if usage else "" + "## Token usage:\n\n2 input, 5 output\n\n" if usage else "" ) + ( "# YYYY-MM-DDTHH:MM:SS conversation: abc123\n\n" "Model: **davinci**\n\n" @@ -86,7 +86,7 @@ def test_logs_text(log_path, usage): "## Response:\n\n" "response\n\n" ) + ( - "## Token usage:\n\n2 input, 5 output\n" if usage else "" + "## Token usage:\n\n2 input, 5 output\n\n" if usage else "" )