Class: Cadenya::Types::ObjectiveDiagnostics

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(context_lengths: nil, input_tokens: nil, cached_input_tokens: nil) ⇒ ObjectiveDiagnostics

Returns a new instance of ObjectiveDiagnostics.



3673
3674
3675
3676
3677
# File 'lib/cadenya/types.rb', line 3673

def initialize(context_lengths: nil, input_tokens: nil, cached_input_tokens: nil)
  @context_lengths = context_lengths
  @input_tokens = input_tokens
  @cached_input_tokens = cached_input_tokens
end

Instance Attribute Details

#cached_input_tokensObject (readonly)

Returns the value of attribute cached_input_tokens.



3671
3672
3673
# File 'lib/cadenya/types.rb', line 3671

def cached_input_tokens
  @cached_input_tokens
end

#context_lengthsObject (readonly)

Returns the value of attribute context_lengths.



3671
3672
3673
# File 'lib/cadenya/types.rb', line 3671

def context_lengths
  @context_lengths
end

#input_tokensObject (readonly)

Returns the value of attribute input_tokens.



3671
3672
3673
# File 'lib/cadenya/types.rb', line 3671

def input_tokens
  @input_tokens
end

Class Method Details

.from_json(data) ⇒ Object



3679
3680
3681
3682
3683
3684
3685
# File 'lib/cadenya/types.rb', line 3679

def self.from_json(data)
  new(
    context_lengths: data["contextLengths"].nil? ? nil : Types::ContextLengths.from_json(data["contextLengths"]),
    input_tokens: data["inputTokens"],
    cached_input_tokens: data["cachedInputTokens"],
  )
end

Instance Method Details

#to_hObject



3687
3688
3689
3690
3691
3692
3693
# File 'lib/cadenya/types.rb', line 3687

def to_h
  {
    context_lengths: Util.plain(@context_lengths),
    input_tokens: Util.plain(@input_tokens),
    cached_input_tokens: Util.plain(@cached_input_tokens),
  }.reject { |_k, v| v.nil? }
end