github crmne/ruby_llm 1.1.0rc2

latest releases: 1.2.0, 1.1.2, 1.1.1...
pre-release26 days ago

RubyLLM 1.1.0.rc2: Smart Error Handling & Testing Improvements ๐Ÿ› ๏ธ

This second release candidate introduces a new error handling paradigm for tools, improves error parsing across providers, and enhances testing infrastructure. The focus is on making applications more resilient and developer-friendly.

๐Ÿ› ๏ธ Smarter Tool Error Handling

A completely new approach to handling errors in tools that lets LLMs handle recoverable issues while bubbling up critical errors to your application:

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:)
    validate_coordinates!(latitude, longitude)
    response = Faraday.get(weather_api_url(latitude, longitude))
    
    case response.status
    when 429
      # Return errors the LLM should know about and can retry
      { error: "Rate limit exceeded. Please try again in 60 seconds." }
    when 200
      JSON.parse(response.body)
    else
      # Let serious problems bubble up
      raise "Weather API error: #{response.status}"
    end
  end
end

When to Return vs Raise Errors

  • Return errors to the LLM when:

    • Input validation fails
    • The operation can be retried (rate limits, temporary failures)
    • Alternative approaches might work
  • Let errors bubble up when:

    • The tool encounters unexpected states
    • System resources are unavailable
    • Authentication or authorization fails
    • Data integrity is compromised

๐Ÿ” Provider Improvements

  • Better error parsing for AWS Bedrock responses
  • Enhanced system prompt handling across all providers
  • with_instructions(replace: true) now available for Plain Old Ruby Objects

๐Ÿงช Testing Infrastructure

New testing capabilities focusing on error handling:

  • Added chat_error_spec to catch problems with error parsing
  • Enhanced CI workflow with prerelease version checking

๐Ÿ“š Documentation Updates

  • New comprehensive model information guide listing 100+ models with capabilities
  • Updated error handling guidelines
  • Streamlined contribution guidelines

This is a release candidate. Please test thoroughly, especially the new error handling features!

gem 'ruby_llm', '1.1.0.rc2'

Contributors

Thanks to everyone who contributed to this release, especially @tpaulshippy for Bedrock improvements, and @keithrbennett for the model information guide.

New Contributors

Full Changelog: 1.1.0rc1...1.1.0rc2

Don't miss a new ruby_llm release

NewReleases is sending notifications on new releases.