redlines icon indicating copy to clipboard operation
redlines copied to clipboard

cli.py truncates long strings

Open jeisner opened this issue 1 year ago • 4 comments

Only 6 lines are shown in the CLI output. Can this be expanded for long outputs, either automatically or by command-line options?

jeisner avatar Oct 01 '24 04:10 jeisner

Hi sorry, I haven't touched the cli part of this for a while, since I was also considering the status of a related project: https://github.com/houfu/redlines-textual

But can I check your use case? Are you talking about long outputs (like just a few more lines) or really long outputs.

houfu avatar Oct 02 '24 07:10 houfu

Thanks for the pointer to the related project.

I think redlines CLI is more useful for shorter text that can be compared at the terminal or in a bash_kernel notebook cell.

(To compare versions of longer documents, a diff tool seems more appropriate - it usually lets you jump from change to change. Although I suppose there are times that you just want to read the long document, for example in less, and have a little extra markup along the way, showing what's new.)

When I posted this issue, I was using redlines at the terminal to compare LLM outputs under different prompts. These outputs can vary in length; in my case they were several sentences. I ended up writing my own bare-bones version of the script, which worked fine:

import sys
from redlines import Redlines
from rich import print
print(Redlines(sys.argv[1], sys.argv[2]).output_rich)

jeisner avatar Oct 02 '24 10:10 jeisner

Thanks! It seems that unlike textual, rich doesn't easily have scrollbars in their panels. So it looks like it will be a limitation for now. But I thought your script made sense so I made it a new command. I wrote the code, but I hope you don't mind if I credit you for it.

houfu avatar Oct 02 '24 16:10 houfu

As you like.
Although to prevent a profusion of CLIs, I wonder this should just be an option to your existing script? (I could also imagine the existing script warning of truncation, when it happens, and recommending the option.)

jeisner avatar Oct 02 '24 18:10 jeisner