Class: Cadenya::Types::AIProviderConfig_Openai

Inherits:
Object
  • Object
show all
Defined in:
lib/cadenya/types.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type: nil, openai: nil) ⇒ AIProviderConfig_Openai

Returns a new instance of AIProviderConfig_Openai.



9325
9326
9327
9328
# File 'lib/cadenya/types.rb', line 9325

def initialize(type: nil, openai: nil)
  @type = type
  @openai = openai
end

Instance Attribute Details

#openaiObject (readonly)

Returns the value of attribute openai.



9323
9324
9325
# File 'lib/cadenya/types.rb', line 9323

def openai
  @openai
end

#typeObject (readonly)

Returns the value of attribute type.



9323
9324
9325
# File 'lib/cadenya/types.rb', line 9323

def type
  @type
end

Class Method Details

.from_json(data) ⇒ Object



9330
9331
9332
9333
9334
9335
# File 'lib/cadenya/types.rb', line 9330

def self.from_json(data)
  new(
    type: data["type"],
    openai: data["openai"].nil? ? nil : Types::OpenAIConfig.from_json(data["openai"]),
  )
end

Instance Method Details

#to_hObject



9337
9338
9339
9340
9341
9342
# File 'lib/cadenya/types.rb', line 9337

def to_h
  {
    type: Util.plain(@type),
    openai: Util.plain(@openai),
  }.reject { |_k, v| v.nil? }
end