mirror of
https://github.com/almet/notmyidea.git
synced 2025-04-28 19:42:37 +02:00
52 lines
No EOL
3.1 KiB
HTML
52 lines
No EOL
3.1 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
|
|
<head>
|
|
<title>llm command-line 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 tips</h1>
|
|
<time datetime="2023-09-27T00:00:00+02:00">27 septembre 2023</time>
|
|
|
|
|
|
</header>
|
|
<article>
|
|
<p>I’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’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 json.</p>
|
|
<p>All in all, it’s pretty satisfying to use. I finally got a simple way to query databases! I’m also using <a href="https://github.com/charmbracelet/glow">glow</a>, which is capable of transforming markdown into a better version on the terminal.</p>
|
|
<div class="highlight"><pre><span></span><code>sqlite-utils<span class="w"> </span><span class="s2">"</span><span class="k">$(</span>llm<span class="w"> </span>logs<span class="w"> </span>path<span class="k">)</span><span class="s2">"</span><span class="w"> </span><span class="s2">"SELECT * FROM responses WHERE prompt LIKE '%search%'"</span><span class="w"> </span><span class="p">|</span><span class="w"> </span>jq<span class="w"> </span><span class="s1">'.[].response'</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 :-)</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> |