Class: Roseflow::OpenAI::ModelRepository

Inherits:
Object
  • Object
show all
Defined in:
lib/roseflow/openai/model_repository.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(provider) ⇒ ModelRepository

Returns a new instance of ModelRepository.



12
13
14
15
# File 'lib/roseflow/openai/model_repository.rb', line 12

def initialize(provider)
  @provider = provider
  @models = provider.client.models
end

Instance Attribute Details

#modelsObject (readonly)

Returns the value of attribute models.



8
9
10
# File 'lib/roseflow/openai/model_repository.rb', line 8

def models
  @models
end

Instance Method Details

#chattableObject

Returns all models that are chattable.



25
26
27
# File 'lib/roseflow/openai/model_repository.rb', line 25

def chattable
  @models.select(&:chattable?)
end

#completionableObject

Returns all models that are completionable.



30
31
32
# File 'lib/roseflow/openai/model_repository.rb', line 30

def completionable
  @models.select(&:completionable?)
end

#editableObject

Returns all models that are support edits.



35
36
37
# File 'lib/roseflow/openai/model_repository.rb', line 35

def editable
  @models.select(&:editable?)
end

#embeddableObject

Returns all models that are support embeddings.



40
41
42
# File 'lib/roseflow/openai/model_repository.rb', line 40

def embeddable
  @models.select(&:embeddable?)
end

#find(name) ⇒ Object

Finds a model by name.

Parameters:

  • name (String)

    Name of the model



20
21
22
# File 'lib/roseflow/openai/model_repository.rb', line 20

def find(name)
  @models.select{ |model| model.name == name }.first
end