artem

artem

LLM with Livebook - any tips or workflows you recommend?

Hi All

I use AI with my elixir coding pretty successfully. Maybe it tells more about my elixir skills level, but I manage to get quite a lot of use from Cursor Composer agent mode which suggests changes to files and I can accept/reject with a click. And I can add hex docs of needed libraries to it, so it’s aware of APIs needed!

My current project is an RnD in Livebook and… I fail to figure out a good workflow for livebooks. Just editing running livebooks’s markdown file doesn’t work as it local changes will not be loaded and even more, any changes done in livebook UI will overwrite the file.

Good workflow
The best I was able to figure so far is to just chat with my livebook content in Cursor Composer and copy-paste content from chat to livebook and back. It works, but it tedious.

What do you use for AI in livebook?

  • Same copy-paste between chats approach?
  • Or is there an [easy] way to ask livebook session refresh itself from file instead of autosaving to file somehow?
  • Or is there some agent tool able to edit livebook content in browser?
  • Something else?

Marked As Solved

Also Liked

artem

artem

The process for setting it up was a bit tough (e.g. I had to switch from Livebook desktop to versioned livebooks installed to asdf internals) and I had to learn how mcp servers work, but in the end it was a very good solution. Thanks, @nulltree !

artem

artem

Self-answering of what worked for me okayish so far.

Tool I use
First of all Cursor Composer Agent is good and helps (with my level of elixir skills). Indeed it is not too knowledgeable on elixir idioms, so you may need to ask it to pay more attention to elixir idiomacy (e.g. more pattern matching, less branhing) + add some documentation on the libraries you use (e.g. to its list of docs you can just add links to hexdocs of Kinio, Tesla, etc). Sure it also sometimes makes stupid mistakes, but if I look after it, then it helps me code quite significantly. Except for this issue with LiveView ignoring and overwriting the underlying files.

So here’s what I used with some success:

Option for short notebooks: Just copy-pasting
You ask for Cursor agent suggestions, but do not apply to a file. Just copy-paste them to livebook editor manually. With small livebook notebooks it actually worked surprisingly well and wasn;t too annoying.

Option for large notebooks: Agent to edit file and then reconnect
Then my notebook grew from “just a small exploration” into "let’s make an externally accessible API out of it. Still RnD, but with some thinking of proper error handling, several secrets, Livebook Teams deployment, etc) and copy-pasting across many cells became painful. I figured the following process:

  1. Type next prompt to Cursor, discuss with it whatever you want. You notebook can be running meanwhile: As long as you type nothing in the livebook UI it doesn’t seem to overwrite the underlying file
  2. Close the session via notebook’s top of page button. It takes you to the Livebook home page
  3. Click open and notebook you just worked on will be on top of the Recent ones, so quick open
  4. From address bar copy session ID (that I’ll need in the end to send HTTP request)
  5. In sidebar open secrets (keyboard shortcut “ss”) and enable whichever secrets you need
  6. In sibebar open outline (keyboard shortcut “so”) click on the final section (or whichever section starts what you need to test and evaluate it"
  7. Eventually in postman (or whichever tool you use for sending http requests) replace old session id with the one copied on step 4 and you can send requests

It looks like a lot of things to do and I am not super-happy with the process indeed. However, once I did it several times it got to muscle memory and I am relatively fast with it - faster and more accurate than with copy-pasting indeed.

Any other options?
Does anybody have a better idea? After all what I am essentially doing it just close-recreate session for the same file (and reenable same secrets). Is there possibly some way e.g. to send message from IEex console to do it all in one go?

artem

artem

Wow, if it works, that seems to be exactly what I was hoping for! Thanks, Leon, I’ll give it a try!

Where Next?

Popular in Questions Top

yawaramin
In the Dialyzer docs ( http://erlang.org/doc/man/dialyzer.html#requesting-or-suppressing-warnings-in-source-files ), there is a way to tu...
New
New
dokuzbir
Hello, I am trying to convert my lists to string without losing brackets.For start i have 3 map. They look like these buyer = %{ id: ...
New
hariharasudhan94
I would like to know what is the best IDE for elixir development?
New
mgjohns61585
Could someone help me? I'm making my first elixir program, number guessing game. I can't figure out how to convert the user's guess from ...
New
ovidiubadita
Hey all, I discovered Elixir and I love it. I always wanted to learn a functional programming and I intended to go for Haskell, but afte...
New
Patoshizzle
After calling mix ecto.create I get this error: 17:00:32.162 [error] GenServer #PID<0.412.0> terminating ** (Postgrex.Error) FATAL...
New
Exadra37
Sometimes I want to check if the input into a function is not a blank string. My first approach: defmodule Example do def do_stuff(s...
New
Fl4m3Ph03n1x
About me? ( if you have nothing better to do than reading about some random guy in the internet :stuck_out_tongue: ) Hello all, this is ...
New
joeerl
Hello again - after a longish gap I’ve decided I really must dig into Elixir and see what’s been happening here - so I have a few questio...
New

Other popular topics Top

shahryarjb
Hello, I get Persian date from my client and convert it to normal calendar like this: def jalali_string_to_miladi_english_number(persi...
New
aalberti333
As the title describes, I’m trying to run Enum.map() over a list of key/value pairs, where the value is a map. My data looks like this: ...
New
fireproofsocks
I’m working on defining a simple Ecto schema for a table (in PostGres), but I don’t see where I can define a column as NOT NULL. Conside...
New
chrismccord
This release brings a number of exciting features, including integration with the new Phoenix LiveDashboard and Phoenix LiveView. There h...
New
script
If I have a string “1000 cfu/ml” . I want to remove the characters and / and space . So the string is like this "1000" What is the ...
New
mcarvalho
What is the difference between System.get_env and Application.get_env? For example, what are best practices to use one versus another.
New
ashish173
I am using Ecto timestamps with postgres, I can see the timestamps() use the :naive_dateime but for my use case I wanted to store the ti...
New
alice
Hey, Just curious what are the main benefits of Elixir compared to Clojure? When is Elixir more useful than Clojure and vice versa? Th...
New
Fl4m3Ph03n1x
About me? ( if you have nothing better to do than reading about some random guy in the internet :stuck_out_tongue: ) Hello all, this is ...
New
siddhant3030
Hi, I have to write a raw query for one of my project. But till now I have used ecto queries and don’t have much experience writing raw ...
New

We're in Beta

About us Mission Statement