Class: EmbeddingUtil::Provider

Inherits:
Object
  • Object
show all
Defined in:
lib/embedding_util/provider.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config: EmbeddingUtil.configuration) ⇒ Provider

Returns a new instance of Provider.



7
8
9
# File 'lib/embedding_util/provider.rb', line 7

def initialize(config: EmbeddingUtil.configuration)
  @config = config
end

Instance Attribute Details

#configObject (readonly)

Returns the value of attribute config.



5
6
7
# File 'lib/embedding_util/provider.rb', line 5

def config
  @config
end

Class Method Details

.provider_nameObject



11
12
13
# File 'lib/embedding_util/provider.rb', line 11

def self.provider_name
  name.split("::").last.gsub(/([a-z\d])([A-Z])/, "\\1_\\2").downcase.to_sym
end

.supported?(config = EmbeddingUtil.configuration) ⇒ Boolean

Returns:

  • (Boolean)


15
16
17
# File 'lib/embedding_util/provider.rb', line 15

def self.supported?(config = EmbeddingUtil.configuration)
  new(config: config).supported?
end

Instance Method Details

#provider_nameObject



19
20
21
# File 'lib/embedding_util/provider.rb', line 19

def provider_name
  self.class.provider_name
end

#supportObject



27
28
29
# File 'lib/embedding_util/provider.rb', line 27

def support
  { provider: provider_name, supported: supported? }
end

#supported?Boolean

Returns:

  • (Boolean)


23
24
25
# File 'lib/embedding_util/provider.rb', line 23

def supported?
  false
end