Experimenting with Retrieval Augmented Generation (RAG) with LLMs

Note well Please ensure you consider and adhere to any policies and restrictions your organisation places on the use of data with AI and the selection of AI models. I want to be able to ask an generative AI some questions while giving it the context from which I’d like it to use it’s smarts to derive an answer. This is Retrieval-Augmented Generation (RAG). Being a Ruby engineer, I’m going to pick up my shiny red hammer to attack this problem....

April 4, 2025 · 4 min · 837 words · Nigel Brookes-Thomas

TiL: Using the max_by method in Ruby

When trying to get an upper or lower value for a certain field in an object can be cumbersome. But when using the max_by method, this can actually be done quite elegantly. For example: persons = [ { "name" => "John McJohnson","age" => 34, "topScoreAtBowling" => 205}, { "name" => "Davey Jones","age" => 304, "topScoreAtBowling" => 300}, { "name" => "Willy Wonka","age" => 50, "topScoreAtBowling" => 200} ] If we had a bowling competition and wanted to see who had the topScoreAtBowling field, rather than looping through the array and looking at each object, we can simply use the max_by command as follows:...

February 20, 2025 · 1 min · 170 words · Tomos Griffiths

Postman-Paf-js

Postman-Paf-js We’ve recently released a library called postman-paf-js that we use to apply Royal Mail rules & exceptions to PAF (Postcode Address File) addresses when converting to a printable format. We also have a ruby implementation. Why is Postman Paf required? To put it simply, UK addresses are more complicated than they might seem. But aren’t addresses just a few set lines that appear on your letters? Unfortunately, it’s not that simple!...

February 6, 2025 · 4 min · 843 words · Nathan Morris

Toggling Ruby scenarios in Drone using secrets

TiL how to toggle Ruby scenarios to be run using CI pipeline secrets Scenario In a relatively niche scenario, we have functionality that is being temporarily removed while new code is being developed. While we still want to keep our current scenarios for function X to use them again when it’s reintroduced, if they are left to run in our pipeline, every build will fail until it is reintroduced again....

November 7, 2024 · 4 min · 707 words · Leighton Taylor

TiL: The difference between exec and system in Ruby

Ruby provides a few different ways to execute commands against the underlying kernel programmatically, but they all work slightly differently. The simplest way to execute a command againts the shell is to surround it in backticks. For example, the following will run the command date and return whatever was output to $stdout. current_date = `date` However, there are also more explict methods you can call. In particular, there is exec and system which look like they do the same thing at a quick glance....

September 23, 2024 · 2 min · 425 words · George Bell