blog.notmyidea.org/llm-command-line-tips.html

47 lines
No EOL
2.7 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<title>llm command-line&nbsp;tips - Alexis Métaireau</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://blog.notmyidea.org/theme/css/main.css" type="text/css" />
<link href="https://blog.notmyidea.org/feeds/all.atom.xml" type="application/atom+xml" rel="alternate"
title="Alexis Métaireau ATOM Feed" />
</head>
<body>
<section id="links">
<ul>
<li><a class="main" href="/">Alexis Métaireau</a></li>
<li><a class=""
href="https://blog.notmyidea.org/journal/index.html">Journal</a></li>
<li><a class="selected"
href="https://blog.notmyidea.org/code/">Code, etc.</a></li>
<li><a class=""
href="https://blog.notmyidea.org/weeknotes/">Notes hebdo</a></li>
<li><a class=""
href="https://blog.notmyidea.org/lectures/">Lectures</a></li>
</ul>
</section>
<header>
<h1 class="post-title">llm command-line&nbsp;tips</h1>
<time datetime="2023-09-27T00:00:00+02:00">27 septembre 2023</time>
</header>
<article>
<p>I&#8217;m using <a href="https://llm.datasette.io">llm</a> more and more, and today I had to find back prompts I used in the past. Here is a command I&#8217;ve been using, which allows me to filter the results based on what I want. It leverages <a href="https://sqlutils.datasette.io">sql-utils</a>, a cli tool which is able to talk to a <span class="caps">SQLITE</span> database and answer in json, and <a href="https://github.com/jqlang/jq">jq</a> a command-line tool capable of doing requests for&nbsp;json.</p>
<p>All in all, it&#8217;s pretty satisfying to use. I finally got a simple way to query databases! I&#8217;m also using <a href="https://github.com/charmbracelet/glow">glow</a>, which is capable of transforming markdown into a better version on the&nbsp;terminal.</p>
<p><span class="dquo">&#8220;</span>`bash
sqlite-utils &#8220;$(llm logs path)&#8221; &#8220;<span class="caps">SELECT</span> * <span class="caps">FROM</span> responses <span class="caps">WHERE</span> prompt <span class="caps">LIKE</span> &#8216;%search%&#8217;&#8221; | jq &#8216;.[].response&#8217; -r | glow&nbsp;&#8220;&#8220;</p>
<p>Which got me a colored response&nbsp;:-)</p>
<p>
<a href="https://blog.notmyidea.org/tag/python.html">#python</a>, <a href="https://blog.notmyidea.org/tag/llm.html">#llm</a>, <a href="https://blog.notmyidea.org/tag/bash.html">#bash</a>, <a href="https://blog.notmyidea.org/tag/sqlite.html">#sqlite</a> - Posté dans la catégorie <a href="https://blog.notmyidea.org/code/">code</a>
</p>
</article>
</body>
</html>