BoxcarsAI / boxcars

Building applications with composability using Boxcars with LLM's. Inspired by LangChain.
MIT License
430 stars 39 forks source link

undefined method `default_train' for Boxcars:Module (ActiveRecord example) #66

Closed itsderek23 closed 1 year ago

itsderek23 commented 1 year ago

Hi,

In the docs for the ActiveRecord Boxcar, it shows the following example code:

# run a Train for an Active Record
boxcars = [Boxcars::ActiveRecord.new]
train = Boxcars.default_train.new(boxcars: boxcars)

puts train.run "How many tickets does Pedro have open?"

However, Boxcars.default_train throws an exception for me:

3.2.0 :009 > boxcars = [Boxcars::ActiveRecord.new]
3.2.0 :010 > train = Boxcars.default_train.new(boxcars: boxcars)
(irb):10:in `<main>': undefined method `default_train' for Boxcars:Module (NoMethodError)
    from /Users/derek/.rvm/rubies/ruby-3.2.0/lib/ruby/gems/3.2.0/gems/irb-1.6.2/exe/irb:11:in `<top (required)>'
    from /Users/derek/.rvm/rubies/ruby-3.2.0/bin/irb:25:in `load'
    from /Users/derek/.rvm/rubies/ruby-3.2.0/bin/irb:25:in `<main>'
itsderek23 commented 1 year ago

I believe it should be changed to Boxcars.train?

francis commented 1 year ago

Yes, that is correct. It was shortened to train, but you can override this default train with Boxcars.configuration.default_train.

francis commented 1 year ago

I've fixed the docs. @itsderek23 👍