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

52 lines
No EOL
3.1 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?v2" 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>
<div id="content">
<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>
<div class="highlight"><pre><span></span><code>sqlite-utils<span class="w"> </span><span class="s2">&quot;</span><span class="k">$(</span>llm<span class="w"> </span>logs<span class="w"> </span>path<span class="k">)</span><span class="s2">&quot;</span><span class="w"> </span><span class="s2">&quot;SELECT * FROM responses WHERE prompt LIKE &#39;%search%&#39;&quot;</span><span class="w"> </span><span class="p">|</span><span class="w"> </span>jq<span class="w"> </span><span class="s1">&#39;.[].response&#39;</span><span class="w"> </span>-r<span class="w"> </span><span class="p">|</span><span class="w"> </span>glow
</code></pre></div>
<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>
<footer>
<a id="feed" href="/feeds/all.atom.xml"><img src="/theme/rss.svg" /></a>
</footer>
</div>
</body>
</html>