Class: Kreuzberg::EmbeddingModelTypePlugin

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

Overview

In-process embedding backend registered via the plugin system.

The caller registers an [‘EmbeddingBackend`](crate::plugins::EmbeddingBackend) once (e.g. a wrapper around an already-loaded `llama-cpp-python`, `sentence-transformers`, or tuned ONNX model), then references it by name in config. Kreuzberg calls back into the registered backend during chunking and standalone embed requests —no HuggingFace download, no ONNX Runtime requirement, no HTTP sidecar.

When this variant is selected, only the following [‘EmbeddingConfig`] fields apply: `normalize` (post-call L2 normalization) and `max_embed_duration_secs` (dispatcher timeout). Model-loading fields (`batch_size`, `cache_dir`, `show_download_progress`, `acceleration`) are ignored — the host owns the model lifecycle.

Semantic chunking falls back to [‘ChunkingConfig::max_characters`] when this variant is used, since there is no preset to look a chunk-size ceiling up against — size your context window via `max_characters` directly.

See ‘register_embedding_backend`.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#nameObject (readonly)

rubocop:disable Lint/UselessMethodDefinition



301
302
303
# File 'lib/kreuzberg/native.rb', line 301

def name
  @name
end

Class Method Details

.from_hash(hash) ⇒ Object



319
320
321
# File 'lib/kreuzberg/native.rb', line 319

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

Instance Method Details

#custom?Boolean

Returns:

  • (Boolean)


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

def custom? = false

#llm?Boolean

Returns:

  • (Boolean)


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

def llm? = false

#plugin?Boolean

Returns:

  • (Boolean)


315
316
317
# File 'lib/kreuzberg/native.rb', line 315

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

#preset?Boolean

Returns:

  • (Boolean)


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

def preset? = false