Class: Kreuzberg::Config::Embedding
- Inherits:
-
Object
- Object
- Kreuzberg::Config::Embedding
- Defined in:
- lib/kreuzberg/config.rb
Overview
Embedding model configuration for document chunking
Instance Attribute Summary collapse
-
#batch_size ⇒ Object
readonly
Returns the value of attribute batch_size.
-
#cache_dir ⇒ Object
readonly
Returns the value of attribute cache_dir.
-
#model ⇒ Object
readonly
Returns the value of attribute model.
-
#normalize ⇒ Object
readonly
Returns the value of attribute normalize.
-
#show_download_progress ⇒ Object
readonly
Returns the value of attribute show_download_progress.
Instance Method Summary collapse
-
#initialize(model: { type: :preset, name: 'balanced' }, normalize: true, batch_size: 32, show_download_progress: false, cache_dir: nil) ⇒ Embedding
constructor
A new instance of Embedding.
- #to_h ⇒ Object
Constructor Details
#initialize(model: { type: :preset, name: 'balanced' }, normalize: true, batch_size: 32, show_download_progress: false, cache_dir: nil) ⇒ Embedding
Returns a new instance of Embedding.
255 256 257 258 259 260 261 262 263 264 265 266 267 |
# File 'lib/kreuzberg/config.rb', line 255 def initialize( model: { type: :preset, name: 'balanced' }, normalize: true, batch_size: 32, show_download_progress: false, cache_dir: nil ) @model = normalize_model(model) @normalize = boolean_or_nil(normalize) @batch_size = batch_size&.to_i @show_download_progress = boolean_or_nil(show_download_progress) @cache_dir = cache_dir&.to_s end |
Instance Attribute Details
#batch_size ⇒ Object (readonly)
Returns the value of attribute batch_size.
253 254 255 |
# File 'lib/kreuzberg/config.rb', line 253 def batch_size @batch_size end |
#cache_dir ⇒ Object (readonly)
Returns the value of attribute cache_dir.
253 254 255 |
# File 'lib/kreuzberg/config.rb', line 253 def cache_dir @cache_dir end |
#model ⇒ Object (readonly)
Returns the value of attribute model.
253 254 255 |
# File 'lib/kreuzberg/config.rb', line 253 def model @model end |
#normalize ⇒ Object (readonly)
Returns the value of attribute normalize.
253 254 255 |
# File 'lib/kreuzberg/config.rb', line 253 def normalize @normalize end |
#show_download_progress ⇒ Object (readonly)
Returns the value of attribute show_download_progress.
253 254 255 |
# File 'lib/kreuzberg/config.rb', line 253 def show_download_progress @show_download_progress end |
Instance Method Details
#to_h ⇒ Object
269 270 271 272 273 274 275 276 277 |
# File 'lib/kreuzberg/config.rb', line 269 def to_h { model: @model, normalize: @normalize, batch_size: @batch_size, show_download_progress: @show_download_progress, cache_dir: @cache_dir }.compact end |