LRUG - May 2025
lbarasti
Focus on what we can control.
Consider the adoption of techniques that look
battle-tested
improves your day-to-day
internal use / read-only
think beyond current limitations
class Weather < RubyLLM::Tool
description 'Gets current weather for a location'
param :latitude, desc: 'Latitude (e.g., 52.5200)'
param :longitude, desc: 'Longitude (e.g., 13.4050)'
end
What
class Weather < RubyLLM::Tool
description 'Gets current weather for a location'
param :latitude, desc: 'Latitude (e.g., 52.5200)'
param :longitude, desc: 'Longitude (e.g., 13.4050)'
def execute(latitude:, longitude:)
url = "#{METEO_API}?lat=#{latitude}&lon=#{longitude}"
response = Faraday.get(url)
JSON.parse(response.body)
end
end
class Weather < RubyLLM::Tool
description 'Gets current weather for a location'
param :latitude, desc: 'Latitude (e.g., 52.5200)'
param :longitude, desc: 'Longitude (e.g., 13.4050)'
def execute(latitude:, longitude:)
url = "#{METEO_API}?lat=#{latitude}&lon=#{longitude}"
response = Faraday.get(url)
JSON.parse(response.body)
rescue StandardError => e
{ error: e.message }
end
end
class Weather < RubyLLM::Tool
description 'Gets current weather for a location'
param :latitude, desc: 'Latitude (e.g., 52.5200)'
param :longitude, desc: 'Longitude (e.g., 13.4050)'
def execute(latitude:, longitude:)
url = "#{METEO_API}?lat=#{latitude}&lon=#{longitude}"
response = Faraday.get(url)
JSON.parse(response.body)
rescue StandardError => e
{ error: e.message }
end
end
What
How
require 'ruby_llm'
# require tools...
How
require 'ruby_llm'
# require tools...
chat = RubyLLM.chat(model: 'gpt-4o-mini')
weather_tool = Weather.new
search_tool = SemanticSearch.new
How
require 'ruby_llm'
# require tools...
chat = RubyLLM.chat(model: 'gpt-4o-mini')
weather_tool = Weather.new
search_tool = SemanticSearch.new
instructions = "You're a helpful assistant"
chat.with_instructions(instructions)
.with_tools(weather_tool, search_tool)
How
chat.with_instructions(instructions)
.with_tools(weather_tool, search_tool)
response = chat.ask(
"what's the weather like in London?")
puts response.content
# => The temperature is 15 degrees...
How
How
Why
Why
A terminal-based chatbot that knows about
🌦️ the weather
💿 your database
📚 ruby gems
💎 RubyLLM
🤖 OpenAI
🌐 pgvector
🙋 What's the weather in Rome?
Weather tool: api.open-meteo.com/v1/forecast?
latitude=#{latitude}&longitude=#{longitude}
[⠙] Thinking...Fetching weather for 41.9028, 12.4964
[⠇] Thinking...
🤖 The current weather in Rome is as follows:
- Temperature: 18.5°C
- Wind Speed: 12.7 km/h
🙋 Who submitted the last order in the database?
[⠋] Thinking...Executing query:
SELECT users.username FROM orders JOIN users ON
orders.user_id = users.id ORDER BY orders.order_date DESC
LIMIT 1;
[⠋] Thinking...
🤖 The last order in the database was submitted by the user "alex_wilson."
🙋 Does ruby_llm support image generation?
[⠋] Thinking...Query: "ruby_llm image generation"
[⠋] Thinking...
🤖 Yes, RubyLLM supports image generation. You can create images using the method RubyLLM.paint
.
Agent failures
Costs
Open-weight vs proprietary models
Privacy
Infosec
MCP