Closed simonw closed 7 months ago
This now works:
llm 'tell me something cool about pelicans'
llm logs -r | ospeak -o /tmp/pelicans.mp3
Took a bit of fiddling to convert that to a mp4
that I could attach to a GitHub issue (it doesn't accept .mp3
or .m4a
). I ended up opening the MP3 in QuickTime Player and exporting it as M4A, then doing this:
ffmpeg -loop 1 -framerate 1 -i mp3.png -i pelicans.m4a \
-c:v libx264 -tune stillimage -c:a aac -b:a 192k -pix_fmt yuv420p -shortest \
output.mp4
Where mp3.png
was this https://upload.wikimedia.org/wikipedia/commons/thumb/e/ea/Mp3.svg/320px-Mp3.svg.png - though that showed up as a black square in the resulting video for some reason:
https://github.com/simonw/llm/assets/9599/f636ff0a-c6af-4b16-a7cd-b120151ae3a8
Without the pipe:
llm logs -r
Pelicans are fascinating creatures with several cool features that set them apart from other birds. Here's one particularly cool aspect about them:
Pelicans have a unique and highly specialized pouch attached to their lower beak. This feature is not just for show—it's an incredibly effective tool for hunting and fishing. Here's how it works:
Elastic Pouch: The pelican's pouch is incredibly stretchy and can hold a large volume of water. When a pelican catches fish, it does not only catch the prey but also a significant amount of water. The pouch can expand multiple times larger than their stomach, which allows them to scoop up substantial quantities of water and fish in a single dive.
Draining Mechanism: After a successful dive, pelicans will often sit on the water's surface, tipping their beaks down to drain out the water before tilting their heads back to swallow the fish. They have a special mechanism for draining the water quickly while filtering out the fish, almost like a built-in sieve.
Cooperative Hunting: Some pelican species, such as the white pelican, are known to work together to herd fish into shallow waters for easier catching. They form a line or a semi-circle and work in unison to scoop up fish corralled into the shallows.
Feeding the Young: Contrary to popular belief, pelicans do not store fish in their pouch to bring back to their chicks. Instead, they swallow the fish and later regurgitate it from their stomachs for the young pelicans to eat.
Not Just for Fish: While most pelican species use their pouches for fishing, the Brown Pelican has a slightly different technique. They dive beak-first into the water from a height, stunning small prey with the impact and scooping them up immediately after.
The pelican's beak and pouch combo is a testament to nature's ingenuity, providing them with an effective and specialized hunting tool to thrive in their watery habitats.
I was about to submit a PR to add in a llm logs last
command, but thankfully found this PR while looking for a commit message format. Cheers, and thanks for all your work on this!
Right now
llm logs list
(and its default aliasllm logs
) returns Markdown with both the prompt and the response. Add--json
and it returns JSON for that.I found myself wanting to repeat just the last response so I could pipe it to
ospeak
.I did this:
But I'd rather have an option to get
llm logs
to output that directly.I think
llm logs -r/--response
would be good - it outputs just the response text from the last returned log line, as raw text ready to be piped to other tools.Using
-r
impliesllm logs list -c
as well, because you are looking for the most recent item.