---
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 :-)
