Class: Xberg::EmbeddingModelTypePlugin

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

Overview

In-process embedding backend registered via the plugin system.

The caller registers an 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. Xberg 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



555
556
557
# File 'lib/xberg/native.rb', line 555

def name
  @name
end

Class Method Details

.from_hash(hash) ⇒ Object



574
575
576
# File 'lib/xberg/native.rb', line 574

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

Instance Method Details

#custom?Boolean

Returns:

  • (Boolean)


566
# File 'lib/xberg/native.rb', line 566

def custom? = false

#llm?Boolean

Returns:

  • (Boolean)


568
# File 'lib/xberg/native.rb', line 568

def llm? = false

#plugin?Boolean

Returns:

  • (Boolean)


570
571
572
# File 'lib/xberg/native.rb', line 570

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

#preset?Boolean

Returns:

  • (Boolean)


564
# File 'lib/xberg/native.rb', line 564

def preset? = false