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



226
227
228
# File 'lib/kreuzberg/native.rb', line 226

def name
  @name
end

Class Method Details

.from_hash(hash) ⇒ Object



249
250
251
# File 'lib/kreuzberg/native.rb', line 249

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

Instance Method Details

#custom?Boolean

Returns:

  • (Boolean)


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

def custom? = false

#llm?Boolean

Returns:

  • (Boolean)


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

def llm? = false

#plugin?Boolean

Returns:

  • (Boolean)


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

def plugin? = true

#preset?Boolean

Returns:

  • (Boolean)


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

def preset? = false