Class: EmbeddingUtil::Providers::SelfHosted

Inherits:
EmbeddingUtil::Provider show all
Defined in:
lib/embedding_util/providers/self_hosted.rb

Instance Attribute Summary

Attributes inherited from EmbeddingUtil::Provider

#config

Instance Method Summary collapse

Methods inherited from EmbeddingUtil::Provider

#initialize, provider_name, #provider_name, supported?

Constructor Details

This class inherits a constructor from EmbeddingUtil::Provider

Instance Method Details

#embed(texts, profile: config.resolved_profile) ⇒ Object



24
25
26
27
# File 'lib/embedding_util/providers/self_hosted.rb', line 24

def embed(texts, profile: config.resolved_profile)
  endpoint = ServerManager.new(config: config).ensure_server(:embedding, profile: profile)
  endpoint_provider(embedding_endpoint: endpoint).embed(texts, profile: profile)
end

#rerank(query, documents, profile: config.resolved_profile) ⇒ Object



29
30
31
32
# File 'lib/embedding_util/providers/self_hosted.rb', line 29

def rerank(query, documents, profile: config.resolved_profile)
  endpoint = ServerManager.new(config: config).ensure_server(:reranker, profile: profile)
  endpoint_provider(reranker_endpoint: endpoint).rerank(query, documents, profile: profile)
end

#supportObject



14
15
16
17
18
19
20
21
22
# File 'lib/embedding_util/providers/self_hosted.rb', line 14

def support
  {
    provider: provider_name,
    supported: supported?,
    runtime: RuntimeCommand.resolve(config.runtime),
    shutdown_idle: config.shutdown_idle,
    state_dir: config.state_dir
  }
end

#supported?Boolean

Returns:

  • (Boolean)


10
11
12
# File 'lib/embedding_util/providers/self_hosted.rb', line 10

def supported?
  ServerManager.supported?(config)
end