Class: Kreuzberg::VlmFallbackPolicyOnLowQuality

Inherits:
Data
  • Object
show all
Extended by:
T::Sig
Includes:
VlmFallbackPolicy
Defined in:
lib/kreuzberg/native.rb

Overview

Try the classical OCR backend first. If the quality score is below ‘quality_threshold`, send the page to the VLM.

‘quality_threshold` is in the `[0.0, 1.0]` range produced by `calculate_quality_score`. A value of `0.5` is a reasonable starting point; calibrate with the Stage 0 benchmark harness.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#quality_thresholdObject (readonly)

rubocop:disable Lint/UselessMethodDefinition



73
74
75
# File 'lib/kreuzberg/native.rb', line 73

def quality_threshold
  @quality_threshold
end

Class Method Details

.from_hash(hash) ⇒ Object



90
91
92
# File 'lib/kreuzberg/native.rb', line 90

def self.from_hash(hash)
  new(quality_threshold: hash[:quality_threshold] || hash["quality_threshold"])
end

Instance Method Details

#always?Boolean

Returns:

  • (Boolean)


86
87
88
# File 'lib/kreuzberg/native.rb', line 86

def always? = false
# @param hash [Hash] deserialized from the native extension
# @return [self]

#disabled?Boolean

Returns:

  • (Boolean)


82
# File 'lib/kreuzberg/native.rb', line 82

def disabled? = false

#on_low_quality?Boolean

Returns:

  • (Boolean)


84
# File 'lib/kreuzberg/native.rb', line 84

def on_low_quality? = true