class RubyLLM::ActiveRecord::FileStore

Keeps a persisted chat’s files in ruby_llm_chat_files, with their content in Active Storage, so they live on whatever service Active Storage uses: a disk now, a bucket later. A persisted chat uses one when ChatFiles#with_file_store is given no store, and RubyLLM.file_store.active_storage builds one.

chat.with_file_store
chat.with_file_store(RubyLLM.file_store.active_storage(chat))
chat.file_store.list

With owner:, the store writes files for that owner and sees only their files and the files without an owner, so in a chat several people share, one person’s tool results stay theirs:

chat.with_file_store(owner: Current.user)

Converted text is kept in the row’s text column. Encrypt it, like anything else the model reads, with RubyLLM::ActiveRecord::ChatFile.encrypts :text.