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



517
518
519
# File 'lib/kreuzberg/native.rb', line 517

def name
  @name
end

Class Method Details

.from_hash(hash) ⇒ Object



535
536
537
# File 'lib/kreuzberg/native.rb', line 535

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

Instance Method Details

#custom?Boolean

Returns:

  • (Boolean)


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

def custom? = false

#llm?Boolean

Returns:

  • (Boolean)


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

def llm? = false

#plugin?Boolean

Returns:

  • (Boolean)


531
532
533
# File 'lib/kreuzberg/native.rb', line 531

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

#preset?Boolean

Returns:

  • (Boolean)


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

def preset? = false