Running Open-Source AI Models Locally with Ruby
reinteractive.com
reinteractive.com
I have been paid to do so-called “AI work” since 1982, lots of early work with neural networks and symbolic AI, then more recently deep learning. I have never been as excited about any technology in my life as I am about LLMs.
Commercial APIs from Anthropic, Mistral, and OpenAI are great tools, but I get off more on running smaller models locally myself.
I have a M2 Pro 32G memory so I need to use 3-bit quantization to run mixtral: dolphin-mixtral:8x7b-v2.5-q3_K_S. In general I don't like to go below 4-bit quantization.
To be fair I work as a PM and I rarely get more than about 60 minutes to play around with anything involving code, which has blocked me on getting hands dirty with anything AI related.
The process to get it running on the gpu wasn't there yet.
It might be overkill for your needs tho.
[0] https://github.com/ttilberg/langchainrb [1] https://github.com/ttilberg/langchainrb/blob/main/lib/langch...
The other kinds of non-conversational context that I needed were trivial to put together myself, so for my use case langchain just got in the way. Ollama's API was already trivial to wrap myself.
https://rubygems.org/gems/ollama-ai
https://github.com/gbaptista/ollama-ai
> A Ruby gem for interacting with Ollama's API that allows you to run open source AI LLMs (Large Language Models) locally
To be fair, this just depends on Faraday and wrap the http API - it still doesn't automate ollama install etc.
Ed: also
https://github.com/andreibondarev/langchainrb
https://github.com/andreibondarev/langchainrb_rails
Ed2: anyone have some insight as to why it doesn't support summarize for ollama?
There is also Nx and Bumblebee in Elixir land - it really changes the how one approaches running models in production. The fact that one can put together a service (or local process) running any model published to hugging face in a couple of lines of code is amazing.
[0] https://github.com/elixir-nx/bumblebee/blob/main/examples/ph...
[1] https://gist.github.com/toranb/8be408eaa97d5a5b795aec7d7fbee...