Module: Rogalik::Plugins::Core::EmbeddingsMethods

Defined in:
lib/rogalik/plugins/core/embeddings_methods.rb

Overview

Mixin that wires the configured embeddings provider into any class that includes it.

When included, included reads the active provider from Rogalik.configuration and delegates to Embeddings.load, which requires the provider file and mixes in its ProviderMethods. The including class therefore gains the full embedding interface (+embed_text+, embed_documents, etc.) without knowing which provider is in use.

Examples:

# config/initializer
Rogalik.configure { |c| c.embeddings.provider = :open_ai }

class MyEmbedder
  include Rogalik::Plugins::Core::EmbeddingsMethods
  # => now has #embed_text, #embed_documents from OpenAIEmbeddings::ProviderMethods
end

Instance Method Summary collapse

Instance Method Details

#embed_documents(_documents) ⇒ Object

Raises:

  • (NotImplementedError)


24
25
26
# File 'lib/rogalik/plugins/core/embeddings_methods.rb', line 24

def embed_documents(_documents)
  raise NotImplementedError, "Embeddings plugins must be included"
end

#embed_text(_text) ⇒ Object

Raises:

  • (NotImplementedError)


28
29
30
# File 'lib/rogalik/plugins/core/embeddings_methods.rb', line 28

def embed_text(_text)
  raise NotImplementedError, "Embeddings plugins must be included"
end