0.0
No release in over 3 years
This gem allows the Rails developer to avoid switching context from Rails error pages during development. When getting an error, you can send the error and logs to an AI model of your choice and get a response to help you understand or pin point the issue while avoiding copy pasting code or logs into an external AI window. Perfect for those who prefer to code with minimal AI presence in their editor of choice!
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Development

Runtime

~> 2.0
~> 8.0, >= 8.0.2.1
 Project Readme

RubberDuck 🦆

RubberDuck is a Rails engine that provides an AI-powered debugging assistant directly on your native Rails development error pages. When an error occurs, a rubber duck button is injected into the page. Clicking it sends error details including log lines and http error to an AI service and displays a contextualized explanation in a modal.

Here's an example of the view it can generate currently Alt text

Usage

  • this gem runs automatically when a standard rails error page shows. No rails commands needed!

⚠️ Warning

Be aware that this gem uses your code and server logs to be sent to the AI model. Do not hardcode sensitive values such as tokens!! However, the gem will not run in production, only in development

Installation

Add this line to your application's Gemfile:

⚠️ Warning

Add this to your development gems. It will not run in production environments!

gem "rubber_duck"

And then execute:

bundle install

Or install it yourself as:

gem install rubber_duck

Run the install generator to create the initializer file:

rails generate rubber_duck:install

Configuration

Before using the gem, you need to configure your AI service API key in the initializer file located at config/initializers/rubber_duck.rb.

  config/initializers/rubber_duck.rb
  RubberDuck.configure do |config|
    # Set your OpenAI API key
    config.openai_api_key = ENV['OPENAI_API_KEY']

    # (Optional) Specify a different AI model to use.
    config.model = 'gpt-4'
  end

Ensure you have set the OPENAI_API_KEY environment variable in your development environment.

Contributing

To be determined...

License

The gem is available as open source under the terms of the MIT License.