class RubyLLM::FileStore::Converters::OCR
Reads scans, photos, and PDFs with RubyLLM.ocr. Each file costs one OCR request the first time the model reads or searches it, and is kept after that. Register it in Configuration#file_converters for the types it should read:
config.file_converters["image/*"] = RubyLLM.file_store.converter.ocr config.file_converters["application/pdf"] = RubyLLM.file_store.converter.ocr(model: "mistral-ocr-latest")
Public Class Methods
Source
# File lib/ruby_llm/file_store/converters/ocr.rb, line 17 def initialize(**options) @options = options end
Creates a converter that calls RubyLLM.ocr with options, such as model:, provider:, or context:.
Public Instance Methods
Source
# File lib/ruby_llm/file_store/converters/ocr.rb, line 22 def call(attachment) RubyLLM.ocr(attachment, **@options).markdown end
Returns the Markdown RubyLLM.ocr reads from attachment.