RubyFlow The Ruby and Rails community linklog

×

The Ruby and Rails community linklog

Made a library? Written a blog post? Found a useful tutorial? Share it with the Ruby community here or just enjoy what everyone else has found!

A practical guide to AI in Rails with RubyLLM: structured text, tools, images

I wrote up the code behind the AI-generated cover images on my blog: a text model summarizes a post, an image model draws the summary, and Active Storage keeps the result. AI with Ruby and Rails: A Practical Guide with RubyLLM goes through it in nine steps with RubyLLM 2.1 and Gemini: a service object for the first call, structured output with with_schema, tool calling, RubyLLM.paint, and moving generation to a background job before Kamal’s proxy times out. It also covers rescuing provider errors and catching the content-filtered reply that comes back empty without raising. The last steps treat user content as data rather than instructions and test without touching the network.

Post a comment

You can use basic HTML markup (e.g. <a>) or Markdown.

As you are not logged in, you will be
directed via GitHub to signup or sign in