juanazam

juanazam

I’ve been experimenting with a small pattern for using AI in apps.
Instead of replacing the UI with a chat, I tried using it to help users build filters.

So a user can type something like: “customers who spent more than $500 in the last 3 months and haven’t ordered recently”

and the app turns that into a struct and runs a normal query (Ecto in this case).

The important part for me was keeping things predictable:

  • the model doesn’t generate queries
  • everything goes through a schema
  • you can still edit the filters manually

Wrote a short post about it:

Showing Posts 1 to 4

joelpaulkoch

joelpaulkoch

Cool! I thought about something similar a while ago: instead of creating filters you could give it a hook point where it generates a function that receives a collection of items and must return the HTML + CSS based on user instructions. Like “show items as grid/list”.

Definitely more complex and not sure if it’s useful at all but would be a fun experiment

tfwright

tfwright

We are in the process of beta testing a feature more or less identical to this, although we needed to support fairly complex filters across multiple tables and in some cases with multiple params. We already had a conventional UI built out, and the backend to support the filter logic.

One thing we did was use the existing function and module docs from the filter logic using Code.fetch_docs to build the LLM context. And then we added a bunch more detail and examples to function docs until the LLM was able to reliably return useful data. The filter logic also already had casting/validation so we could just use that. Took some fiddling, but the entire feature only ended up being a thin wrapper around ReqLLM, a context generator that pulled in all the docs, and an endpoint that called out to those and applied the validation and returned the result. And as a bonus we had more general purpose docs than when we started. Turns out a lot of the instructions that help Claude also help human devs.

I maintain a small utility for dumping docs and as a next step I am going to try to use that to extract the “context baking” logic from runtime code.

juanazam

juanazam OP

Definitely a fun experiment! The challenge of validating the response sounds complicated though :sweat_smile:

juanazam

juanazam OP

So cool that you are releasing something similar in production!
Using Code.fetch_docs to build the LLM context is really smart!
Would love to see some examples of that reqLLM layer if possible!

Turns out a lot of the instructions that help Claude also help human devs.

Agreed.

— All posts loaded —

Where Next? Top

Trending in Blog Posts Top

bartblast
Hey folks, I just published a post about Hologram’s funding and where the project goes next - the short version: Curiosum as Main Spons...
New
pckrishnadas88
Hey everyone! :waving_hand: I’ve published Part 7 of the Building Distributed Systems in Elixir series, where we build core distributed ...
New
zorn
An educational side project in Elixir, Phoenix, and Tauri. I share what I learned while wiring Automerge into the BEAM, including how I s...
New
mudasobwa
So, instead of wasting my afternoon arguing with anonymous handles on X, I turned to my trusty, soulless assistant and said: “Listen, ple...
New
nathanl
Process labels are useful for visualization and debugging. Here’s why you should use them.
New
abreujp
New article: Elixir Project Structure — From mix new to a Growing Codebase I’ve published a new article in my Elixir learning series on d...
New
mudasobwa
Somewhere, right now, a senior engineer is on the verge of a nervous breakdown because his company will not let him switch from Claude to...
New

Other Trending Topics Top

JesseHerrick
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
mudasobwa
I am happy to introduce the very α version of the new programming language compiled to BEAM. Welcome Cure. It has literally three kille...
New
marciok
Hi there! We created Gust: A task orchestrator inspired by Airflow. For those who have never heard about Aiflow, it’s a Python-based wor...
New
mhanberg
Hi everyone! The first release candidate for the Expert language server project is now available! We’ve published a press release detai...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Dmk
Xamal is a deployment tool for Elixir apps that deploys native releases to bare metal servers over SSH. It’s a port of GitHub - basecamp/...
New

Latest on Elixir Forum

Elixir Forum

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews