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



525
526
527
# File 'lib/xberg/native.rb', line 525

def name
  @name
end

Class Method Details

.from_hash(hash) ⇒ Object



543
544
545
# File 'lib/xberg/native.rb', line 543

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

Instance Method Details

#custom?Boolean

Returns:

  • (Boolean)


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

def custom? = false

#llm?Boolean

Returns:

  • (Boolean)


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

def llm? = false

#plugin?Boolean

Returns:

  • (Boolean)


539
540
541
# File 'lib/xberg/native.rb', line 539

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

#preset?Boolean

Returns:

  • (Boolean)


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

def preset? = false