kasvith

kasvith

Hi,

We are trying to develop a LLM chat agent. So far lot of libraries have been written in JS or Python. But Elixir provides an excellent WebSocket support

So we decided to use Elixir Phoenix Sockets to stream responses from LLMs for Chats

Has anyone done this? what are the libraries you used? Any drawbacks on this approach?

Will SSE would be a better option than phoenix sockets?

Showing Posts 1 to 9

ndrean

ndrean

kasvith

kasvith OP

i saw, but this is not about LV

the main problem i saw was all the manual work he had to do to get streaming response from the LLM. For example if we want to switch to Gemini at some point or a custom model have to repeat same kind of code again

i was evaluating whether it worth the trouble

gmile

gmile

@kasvith what was a approach / solution have you settled on at the end of the day?

ruslandoga

ruslandoga

:waving_hand:

I did something like this in GitHub - ruslandoga/wat · GitHub

Relevant bits:

avi-turetsky

avi-turetsky

This has definitely been a pain point for us as well. I know it’s asking for a lot but an equivalent of something like AI SDK by Vercel for elixir would be huge. It’s one of the few times where we’ve really been bit by the smaller ecosystem of elixir. Most of the time you can just write it yourself but as @kasvith mentioned its a lot of manual work to implement streaming for each provider.

kasvith

kasvith OP

Hey guys, we moved on with Vercel AI SDK with SSE

chrismccord

chrismccord

Creator of Phoenix

Req to chat completions with :into and process send and no other libs required. OpenAI compatible endpoints gives you plug and play with many LLMs, including google’s. You can see langchain here for higher level building blocks and integrations, but it’s shockingly easy to get streaming tokens out to a client wether LiveView or js channels client.

gtcode

gtcode

Thanks, Chris. This is fantastic timing because I am researching approaches for building a generalized streaming client in Elixir.

Initial plan was to use a genserver or a supervised Task, then saw your post.

May I ask if you (or anyone) could read this and comment? Rube Goldberg, or good idea?

gtcode

gtcode

I’m working on gemini_ex, which will be a comprehensive adapter for Gemini both using Gemini keys and Vertex auth strategies:

https://github.com/nshkrdotcom/gemini_ex/

Today, I added streaming using SSE and a genserver:

https://github.com/nshkrdotcom/gemini_ex/blob/main/STREAMING_ARCHITECTURE.md

Colors for the mermaid diagram were chosen to be in the Elixir style. The implementation is still very much in alpha/unstable phase.

Open to feedback.

— All posts loaded —

Where Next? Top

Trending in Questions Top

RSP87
I’m working on a project that simulates the bumbl example in the programming phoenix book. It acts almost like an email client. We have a...
New
nseaSeb
Hello, I know there is an approach for handling lists that allows for optimized traversal, but I can’t recall the specific method (somet...
New
RemyXRenard
I’m seeing that a list inside a Kino.DataTable will be interpreted as a charlist, even if the Kino.configure() is set to charlists: :as_l...
New
velrest
So my question is quite simple and i have found no conclusive answer on forum, google or AI. Should we use :erlang.float for Integer to ...
New
brecabral
Documentation While reading the Scoped Routes section, I noticed that the documentation currently refers to a problem without explainin...
New
samoloth
Hi, I’ve just set up an application with ash_authentication. There is only magic link strategy for now, so there is no confirmation add o...
New
FlyingNoodle
If a change or preparation module uses Ash.Changeset.get_argument/2 or Ash.Query.get_argument/2 (or any of the other get_argument functio...
New

Other Trending Topics Top

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
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
netoum
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New
webofbits
With AI doing more of the implementation work, I’ve been wondering how much coding I should deliberately keep doing myself. My main conc...
#ai
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews