Module: Kreuzberg::ChunkingReason

Extended by:
T::Helpers, T::Sig
Included in:
ChunkingReasonLargeAndManyPages, ChunkingReasonLargeFile, ChunkingReasonManyPages, ChunkingReasonOcrRequired
Defined in:
lib/kreuzberg/native.rb

Overview

Reason for chunking a document.

Class Method Summary collapse

Class Method Details

.from_hash(hash) ⇒ Object



4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
# File 'lib/kreuzberg/native.rb', line 4321

def self.from_hash(hash)
  discriminator = hash[:type] || hash["type"]
  case discriminator
  when "large_file" then ChunkingReasonLargeFile.from_hash(hash)
  when "many_pages" then ChunkingReasonManyPages.from_hash(hash)
  when "ocr_required" then ChunkingReasonOcrRequired.from_hash(hash)
  when "large_and_many_pages" then ChunkingReasonLargeAndManyPages.from_hash(hash)
  else raise "Unknown discriminator: #{discriminator}"
  end
end