martosaur

martosaur

Handwave is a thin wrapper around InstructorLite that makes it simpler to use vague handwaving in your apps.

It comes with 3 built-in providers (Handwave.OpenAI, Handwave.Claude and Handwave.Gemini) and behaviour to define your own.

Here’s its whole API surface:

  1. Use llm_if when you can’t come up with a regular if:
import Handwave.OpenAI

llm_if user_email, "looks suspicious?" do
  {:error, :blocked}
else
  create_user(user_email)
end
  1. Use llm_rewrite when you just need that term() -> 🧠🪄✨ -> string function:
iex> llm_rewrite(
          %Req.Response{status: 401, body: "session token expired"},
          "Tell user what to do without technical details"
        )
"Your session has expired. Please log in again to continue."
  1. Use llm_route when you want LLM to just figure out what to do:
import Handwave.OpenAI

@impl Oban.Worker
def process(job) do
  # do things
catch
  kind, error ->
    formatted = Exception.format(kind, error, __STACKTRACE__)
    
    formatted
    |> llm_route([:snooze, :cancel, :error], "Snooze if it makes sense to try later, cancel if it's a lost cause, otherwise just error")
    |> case do
      :snooze -> {:snooze, 60}
      :cancel -> {:cancel, error}
      _ -> {:error, formatted}
    end
end

Have fun.

https://github.com/martosaur/handwave

Showing Posts 1 to 4

FlyingNoodle

FlyingNoodle

llm_if user_email, "looks suspicious?" do

llm_if ← this is a joke right? Are we really at that point?

DaAnalyst

DaAnalyst

I actually like this, specially the llm_rewrite.

llm_if could be useful for non- too-deterministic cases, such as branching in video games.

martosaur

martosaur OP

That were exactly my thoughts that led me to making this package, but ultimately, I came to realization that this is a useful library (that’s why I released it). Structured outputs for LLMs enable embedding small bits of intelligence in conventional application code and at this point I can’t help but admit that sometimes this is useful. Admittedly, examples in the readme are silly, because they have to be small and because I chose a playful tone for the library as a way to cope with new reality. But in real life I use this type of stuff to determine, for example, if user wants to do a “broad” search or “focused” one and trigger different search pipeline based on perceived intent.

I agree that this can be an absolutely cursed way to do things in the wrong hands. I’m not too worried though as it seems like nobody it writing code by hand these days and Claude won’t use this library.

felixbr

felixbr

I love this :grinning_face_with_smiling_eyes:

Initially wasn’t sure if it’s satire or not but maybe we’re at the point where that doesn’t matter anymore.

— All posts loaded —

Where Next? Top

Trending in Announcing Top

restlessronin
The repo is at GitHub - cyberchitta/openai_ex: Community maintained Elixir library for OpenAI API · GitHub. Docs are at OpenaiEx User Gu...
152 12366 136
New
type1fool
WebAuthnLiveComponent WebAuthnComponents See this post about renaming the package. Passwordless authentication for Phoenix LiveView app...
New
GenericJam
Edit: 2026 May 15 - This post is archived. Mob is alive!! Main docs: mob v0.7.11 — Documentation A bit of explanation for the slightly c...
New
woylie
I released Doggo, a collection of unstyled Phoenix components. https://github.com/woylie/doggo Features Unstyled Phoenix components....
New
garrison
Hobbes is a low-level distributed database for the Elixir programming language. Hobbes provides a simple, safe, and scalable storage lay...
New
kip
I’ll shortly be launching Text, a nascent text analysis library. Current functionality In this early version (not ready for prime time) ...
New
kip
Following on from my CLDR lbraries I started work on Unicode transforms. But like everything related to CLDR there is a lot of yak-shavin...
New

Other Trending Topics Top

CodeSync
We have 4 in-person tickets to Code BEAM Europe 2026 (21-22 October, PHIL Haarlem) to give away: 1 diversity ticket (sponsored by AppSi...
New
gus
Happy Friday, all! :slight_smile: Our October meetup is coming up next week - Wednesday, October 14th at 19h CET via Zoom! This month we...
New
budgie
A little off-topic, but I feel like people here have a good head on their shoulders. I used to be quite good at making software. Was luc...
New
KristerV
Hey. Is there anyone here who creates agents in their apps? Not talking about using agents, but creating them. I’m finding it pretty diff...
New
juhalehtonen
There has been a thread to discuss the Stack Overflow Developer Survey on this forum every year since 2018, so here’s yet another one for...
New
budgie
I love Elixir. It’s one of 2 programming languages I’ve ever fallen in love with. But I don’t use it anymore. Serverless was the promis...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews