Live data from Hacker News

RubyLLM: A delightful Ruby way to work with AI

github.com

171–180 of 182 posts

Re: RubyLLM: A delightful Ruby way to work with AI

#171

I understand it's a Ruby thing, `chat = RubyLLM.chat` looks odd. How do I know whether it's a function call returning an object or just an assignment? Why not just use `RubyLLM.chat()` and eliminate the ambiguity?

Because everything in Ruby is an object and everything is a passing messages (ie a method call).

Re: RubyLLM: A delightful Ruby way to work with AI

#173
post #166

Earlier quoted context omitted.

Rails is a hot ball of global mutable state. Good luck with threads.

The default rails application server is puma and it uses threads

Yes, it does. Ruby has a global interpreter lock (GIL) that prevents multiple threads to be executed by the interpreter at the same time, so Puma does have threads, they just can’t run Ruby code at the same time. They can hide IO though.

Re: RubyLLM: A delightful Ruby way to work with AI

#175
post #102

Oh just beautiful. Ruby is so expressive and concise. If you see the typescript options it's like giving yourself a water boarding session through your own volition.

Is it really Ruby or they just made a nice interface? I don't see why a hypothetical TypeScript example would be all that different. // Just ask questions const chat: Chat = LLM.chat; chat.ask("What's the best way to learn TypeScript?"); // Analyze images chat.ask("What's in this image?", { image: "ts_conf.jpg" }); // Generate images LLM.paint("a sunset over mountains in watercolor style"); // Create vector embedding…

[dead]

Re: RubyLLM: A delightful Ruby way to work with AI

#176
post #102

Oh just beautiful. Ruby is so expressive and concise. If you see the typescript options it's like giving yourself a water boarding session through your own volition.

Is it really Ruby or they just made a nice interface? I don't see why a hypothetical TypeScript example would be all that different. // Just ask questions const chat: Chat = LLM.chat; chat.ask("What's the best way to learn TypeScript?"); // Analyze images chat.ask("What's in this image?", { image: "ts_conf.jpg" }); // Generate images LLM.paint("a sunset over mountains in watercolor style"); // Create vector embedding…

[dead]

Re: RubyLLM: A delightful Ruby way to work with AI

#178
post #170

Earlier quoted context omitted.

As a general rule of thumb, don’t yuck someone else’s yum. Plenty of people like the trade offs Ruby makes. And plenty of absolutely huge businesses use it quite successfully (e.g., Shopify, GitHub, GitLab, Airbnb, Stripe). If you don’t like it, don’t use it.

I'll yuck whatever yum I please. I'm not here for your approval. I did 10 years of Ruby. I have some authority on the matter.

lol :D

Re: RubyLLM: A delightful Ruby way to work with AI

#179
post #173

Earlier quoted context omitted.

The default rails application server is puma and it uses threads

Yes, it does. Ruby has a global interpreter lock (GIL) that prevents multiple threads to be executed by the interpreter at the same time, so Puma does have threads, they just can’t run Ruby code at the same time. They can hide IO though.

The GIL is released during common IO operations like the HTTP requests that power LLM communication

Re: RubyLLM: A delightful Ruby way to work with AI

#180

I run engineering for a venture backed AI-first startup and we use Ruby/Rails. For us, it made sense to leverage one of the best domain modeling and ORM frameworks out there. Most of our inference is http calls to foundational models, but we can still fine tune and host models on GPUs using Python. Inference matters, but part of building an effective user platform are the same old SaaS problems we’ve had before, and…

Absolutely love this approach. The power and versatility Rails provides for data modeling is top notch. You're 100% right that many of the problems you must solve when building a SaaS app are the same.
Post reply on HN