mirror of
https://github.com/almet/notmyidea.git
synced 2025-04-28 19:42:37 +02:00
14 lines
906 B
Markdown
14 lines
906 B
Markdown
---
|
|
title: llm command-line tips
|
|
tags: python, llm, bash, sqlite
|
|
---
|
|
|
|
I'm using [llm](https://llm.datasette.io) more and more, and today I had to find back prompts I used in the past. Here is a command I've been using, which allows me to filter the results based on what I want. It leverages [sql-utils](https://sqlutils.datasette.io), a cli tool which is able to talk to a SQLITE database and answer in json, and [jq](https://github.com/jqlang/jq) a command-line tool capable of doing requests for json.
|
|
|
|
All in all, it's pretty satisfying to use. I finally got a simple way to query databases! I'm also using [glow](https://github.com/charmbracelet/glow), which is capable of transforming markdown into a better version on the terminal.
|
|
|
|
```bash
|
|
sqlite-utils "$(llm logs path)" "SELECT * FROM responses WHERE prompt LIKE '%search%'" | jq '.[].response' -r | glow
|
|
```
|
|
|
|
Which got me a colored response :-)
|