class RubyLLM::DownloadedFile
A DownloadedFile contains a provider fileβs bytes. Save it with save or read the bytes with to_blob. It is also a String, so parsers and existing string operations work directly on the result.
RubyLLM.download(file.id, provider: :openai).save("report.pdf")
Public Instance Methods
Source
# File lib/ruby_llm/downloaded_file.rb, line 22 def save(path) File.binwrite(File.expand_path(path), to_blob) path end
Writes the file bytes to path, expanding it first. Returns path.
file.save("report.pdf")
Source
# File lib/ruby_llm/downloaded_file.rb, line 14 def to_blob to_s end
Returns the raw file bytes as a String.