Basic checks
What's broken?
I am trying to use chat.ask, with chat a rails model, inside a transaction, where the arguments to ask include an attachment. I end up with an ActiveStorage::FileNotFoundError coming from
|
tempfile = download_attachment(attachment) |
The reason appears to be that ActiveStorage does not save the attachment until after the transaction is over, which happens after the above mentioned loading takes place. This is similar to rails/rails#41661 and rails/rails#43663.
How to reproduce
- Configure RubyLLM with Rails integration
- Create a Chat model and run
ask with an attachment within a transaction
- Experience
ActiveStorage::FileNotFoundError
Expected behavior
Proceed with the query as outside a transaction
What actually happened
Receive an exception
Environment
- Ruby version: 4.0.2
- RubyLLM version: 1.14.1
Basic checks
What's broken?
I am trying to use
chat.ask, withchata rails model, inside a transaction, where the arguments toaskinclude an attachment. I end up with anActiveStorage::FileNotFoundErrorcoming fromruby_llm/lib/ruby_llm/active_record/message_methods.rb
Line 110 in ac4d5d7
The reason appears to be that ActiveStorage does not save the attachment until after the transaction is over, which happens after the above mentioned loading takes place. This is similar to rails/rails#41661 and rails/rails#43663.
How to reproduce
askwith an attachment within a transactionActiveStorage::FileNotFoundErrorExpected behavior
Proceed with the query as outside a transaction
What actually happened
Receive an exception
Environment