Class: Cadenya::Types::ObjectiveContextWindowData

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(objective_id: nil, sequence: nil, prompt_tokens: nil, completion_tokens: nil, previous_window_continue_instructions: nil) ⇒ ObjectiveContextWindowData

Returns a new instance of ObjectiveContextWindowData.



3618
3619
3620
3621
3622
3623
3624
# File 'lib/cadenya/types.rb', line 3618

def initialize(objective_id: nil, sequence: nil, prompt_tokens: nil, completion_tokens: nil, previous_window_continue_instructions: nil)
  @objective_id = objective_id
  @sequence = sequence
  @prompt_tokens = prompt_tokens
  @completion_tokens = completion_tokens
  @previous_window_continue_instructions = previous_window_continue_instructions
end

Instance Attribute Details

#completion_tokensObject (readonly)

Returns the value of attribute completion_tokens.



3616
3617
3618
# File 'lib/cadenya/types.rb', line 3616

def completion_tokens
  @completion_tokens
end

#objective_idObject (readonly)

Returns the value of attribute objective_id.



3616
3617
3618
# File 'lib/cadenya/types.rb', line 3616

def objective_id
  @objective_id
end

#previous_window_continue_instructionsObject (readonly)

Returns the value of attribute previous_window_continue_instructions.



3616
3617
3618
# File 'lib/cadenya/types.rb', line 3616

def previous_window_continue_instructions
  @previous_window_continue_instructions
end

#prompt_tokensObject (readonly)

Returns the value of attribute prompt_tokens.



3616
3617
3618
# File 'lib/cadenya/types.rb', line 3616

def prompt_tokens
  @prompt_tokens
end

#sequenceObject (readonly)

Returns the value of attribute sequence.



3616
3617
3618
# File 'lib/cadenya/types.rb', line 3616

def sequence
  @sequence
end

Class Method Details

.from_json(data) ⇒ Object



3626
3627
3628
3629
3630
3631
3632
3633
3634
# File 'lib/cadenya/types.rb', line 3626

def self.from_json(data)
  new(
    objective_id: data["objectiveId"],
    sequence: data["sequence"],
    prompt_tokens: data["promptTokens"],
    completion_tokens: data["completionTokens"],
    previous_window_continue_instructions: data["previousWindowContinueInstructions"],
  )
end

Instance Method Details

#to_hObject



3636
3637
3638
3639
3640
3641
3642
3643
3644
# File 'lib/cadenya/types.rb', line 3636

def to_h
  {
    objective_id: Util.plain(@objective_id),
    sequence: Util.plain(@sequence),
    prompt_tokens: Util.plain(@prompt_tokens),
    completion_tokens: Util.plain(@completion_tokens),
    previous_window_continue_instructions: Util.plain(@previous_window_continue_instructions),
  }.reject { |_k, v| v.nil? }
end