Class: Cadenya::Types::ObjectiveToolCallInfo

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: nil, created_by: nil, tool: nil, tool_set: nil) ⇒ ObjectiveToolCallInfo

Returns a new instance of ObjectiveToolCallInfo.



4164
4165
4166
4167
4168
4169
# File 'lib/cadenya/types.rb', line 4164

def initialize(objective: nil, created_by: nil, tool: nil, tool_set: nil)
  @objective = objective
  @created_by = created_by
  @tool = tool
  @tool_set = tool_set
end

Instance Attribute Details

#created_byObject (readonly)

Returns the value of attribute created_by.



4162
4163
4164
# File 'lib/cadenya/types.rb', line 4162

def created_by
  @created_by
end

#objectiveObject (readonly)

Returns the value of attribute objective.



4162
4163
4164
# File 'lib/cadenya/types.rb', line 4162

def objective
  @objective
end

#toolObject (readonly)

Returns the value of attribute tool.



4162
4163
4164
# File 'lib/cadenya/types.rb', line 4162

def tool
  @tool
end

#tool_setObject (readonly)

Returns the value of attribute tool_set.



4162
4163
4164
# File 'lib/cadenya/types.rb', line 4162

def tool_set
  @tool_set
end

Class Method Details

.from_json(data) ⇒ Object



4171
4172
4173
4174
4175
4176
4177
4178
# File 'lib/cadenya/types.rb', line 4171

def self.from_json(data)
  new(
    objective: data["objective"].nil? ? nil : Types::OperationMetadata.from_json(data["objective"]),
    created_by: data["createdBy"].nil? ? nil : Types::Profile.from_json(data["createdBy"]),
    tool: data["tool"].nil? ? nil : Types::BareMetadata.from_json(data["tool"]),
    tool_set: data["toolSet"].nil? ? nil : Types::BareMetadata.from_json(data["toolSet"]),
  )
end

Instance Method Details

#to_hObject



4180
4181
4182
4183
4184
4185
4186
4187
# File 'lib/cadenya/types.rb', line 4180

def to_h
  {
    objective: Util.plain(@objective),
    created_by: Util.plain(@created_by),
    tool: Util.plain(@tool),
    tool_set: Util.plain(@tool_set),
  }.reject { |_k, v| v.nil? }
end