Class: OCI::GenerativeAiAgentRuntime::Models::Trace

Inherits:
Object
  • Object
show all
Defined in:
lib/oci/generative_ai_agent_runtime/models/trace.rb

Overview

The trace that displays the internal progression, such as reasoning and actions during an execution.

This class has direct subclasses. If you are using this class as input to a service operations then you should favor using a subclass over the base class

Constant Summary collapse

TRACE_TYPE_ENUM =
[
  TRACE_TYPE_ERROR_TRACE = 'ERROR_TRACE'.freeze,
  TRACE_TYPE_RETRIEVAL_TRACE = 'RETRIEVAL_TRACE'.freeze,
  TRACE_TYPE_GENERATION_TRACE = 'GENERATION_TRACE'.freeze,
  TRACE_TYPE_TOOL_INVOCATION_TRACE = 'TOOL_INVOCATION_TRACE'.freeze,
  TRACE_TYPE_PLANNING_TRACE = 'PLANNING_TRACE'.freeze,
  TRACE_TYPE_EXECUTION_TRACE = 'EXECUTION_TRACE'.freeze,
  TRACE_TYPE_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze
].freeze

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ Trace

Initializes the object

Parameters:

  • attributes (Hash) (defaults to: {})

    Model attributes in the form of hash

Options Hash (attributes):



107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
# File 'lib/oci/generative_ai_agent_runtime/models/trace.rb', line 107

def initialize(attributes = {})
  return unless attributes.is_a?(Hash)

  # convert string to symbol for hash key
  attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }

  self.key = attributes[:'key'] if attributes[:'key']

  self.parent_key = attributes[:'parentKey'] if attributes[:'parentKey']

  raise 'You cannot provide both :parentKey and :parent_key' if attributes.key?(:'parentKey') && attributes.key?(:'parent_key')

  self.parent_key = attributes[:'parent_key'] if attributes[:'parent_key']

  self.source = attributes[:'source'] if attributes[:'source']

  self.time_created = attributes[:'timeCreated'] if attributes[:'timeCreated']

  raise 'You cannot provide both :timeCreated and :time_created' if attributes.key?(:'timeCreated') && attributes.key?(:'time_created')

  self.time_created = attributes[:'time_created'] if attributes[:'time_created']

  self.time_finished = attributes[:'timeFinished'] if attributes[:'timeFinished']

  raise 'You cannot provide both :timeFinished and :time_finished' if attributes.key?(:'timeFinished') && attributes.key?(:'time_finished')

  self.time_finished = attributes[:'time_finished'] if attributes[:'time_finished']

  self.trace_type = attributes[:'traceType'] if attributes[:'traceType']

  raise 'You cannot provide both :traceType and :trace_type' if attributes.key?(:'traceType') && attributes.key?(:'trace_type')

  self.trace_type = attributes[:'trace_type'] if attributes[:'trace_type']
end

Instance Attribute Details

#keyString

Unique identifier for the event (UUID).

Returns:

  • (String)


26
27
28
# File 'lib/oci/generative_ai_agent_runtime/models/trace.rb', line 26

def key
  @key
end

#parent_keyString

Identifier of the parent event, if applicable (UUID).

Returns:

  • (String)


30
31
32
# File 'lib/oci/generative_ai_agent_runtime/models/trace.rb', line 30

def parent_key
  @parent_key
end

#sourceOCI::GenerativeAiAgentRuntime::Models::SourceDetails



33
34
35
# File 'lib/oci/generative_ai_agent_runtime/models/trace.rb', line 33

def source
  @source
end

#time_createdDateTime

The date and time that the trace was created in the format of an RFC3339 datetime string.

Returns:

  • (DateTime)


37
38
39
# File 'lib/oci/generative_ai_agent_runtime/models/trace.rb', line 37

def time_created
  @time_created
end

#time_finishedDateTime

Timestamp for when the event ended (In RFC 3339).

Returns:

  • (DateTime)


41
42
43
# File 'lib/oci/generative_ai_agent_runtime/models/trace.rb', line 41

def time_finished
  @time_finished
end

#trace_typeString

[Required] The type of the trace.

Returns:

  • (String)


45
46
47
# File 'lib/oci/generative_ai_agent_runtime/models/trace.rb', line 45

def trace_type
  @trace_type
end

Class Method Details

.attribute_mapObject

Attribute mapping from ruby-style variable name to JSON key.



48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/oci/generative_ai_agent_runtime/models/trace.rb', line 48

def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'key': :'key',
    'parent_key': :'parentKey',
    'source': :'source',
    'time_created': :'timeCreated',
    'time_finished': :'timeFinished',
    'trace_type': :'traceType'
    # rubocop:enable Style/SymbolLiteral
  }
end

.get_subtype(object_hash) ⇒ Object

Given the hash representation of a subtype of this class, use the info in the hash to return the class of the subtype.



80
81
82
83
84
85
86
87
88
89
90
91
92
# File 'lib/oci/generative_ai_agent_runtime/models/trace.rb', line 80

def self.get_subtype(object_hash)
  type = object_hash[:'traceType'] # rubocop:disable Style/SymbolLiteral

  return 'OCI::GenerativeAiAgentRuntime::Models::ErrorTrace' if type == 'ERROR_TRACE'
  return 'OCI::GenerativeAiAgentRuntime::Models::RetrievalTrace' if type == 'RETRIEVAL_TRACE'
  return 'OCI::GenerativeAiAgentRuntime::Models::ExecutionTrace' if type == 'EXECUTION_TRACE'
  return 'OCI::GenerativeAiAgentRuntime::Models::GenerationTrace' if type == 'GENERATION_TRACE'
  return 'OCI::GenerativeAiAgentRuntime::Models::ToolInvocationTrace' if type == 'TOOL_INVOCATION_TRACE'
  return 'OCI::GenerativeAiAgentRuntime::Models::PlanningTrace' if type == 'PLANNING_TRACE'

  # TODO: Log a warning when the subtype is not found.
  'OCI::GenerativeAiAgentRuntime::Models::Trace'
end

.swagger_typesObject

Attribute type mapping.



62
63
64
65
66
67
68
69
70
71
72
73
# File 'lib/oci/generative_ai_agent_runtime/models/trace.rb', line 62

def self.swagger_types
  {
    # rubocop:disable Style/SymbolLiteral
    'key': :'String',
    'parent_key': :'String',
    'source': :'OCI::GenerativeAiAgentRuntime::Models::SourceDetails',
    'time_created': :'DateTime',
    'time_finished': :'DateTime',
    'trace_type': :'String'
    # rubocop:enable Style/SymbolLiteral
  }
end

Instance Method Details

#==(other) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • other (Object)

    the other object to be compared



162
163
164
165
166
167
168
169
170
171
172
# File 'lib/oci/generative_ai_agent_runtime/models/trace.rb', line 162

def ==(other)
  return true if equal?(other)

  self.class == other.class &&
    key == other.key &&
    parent_key == other.parent_key &&
    source == other.source &&
    time_created == other.time_created &&
    time_finished == other.time_finished &&
    trace_type == other.trace_type
end

#build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
# File 'lib/oci/generative_ai_agent_runtime/models/trace.rb', line 197

def build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)

  self.class.swagger_types.each_pair do |key, type|
    if type =~ /^Array<(.*)>/i
      # check to ensure the input is an array given that the the attribute
      # is documented as an array but the input is not
      if attributes[self.class.attribute_map[key]].is_a?(Array)
        public_method("#{key}=").call(
          attributes[self.class.attribute_map[key]]
            .map { |v| OCI::Internal::Util.convert_to_type(Regexp.last_match(1), v) }
        )
      end
    elsif !attributes[self.class.attribute_map[key]].nil?
      public_method("#{key}=").call(
        OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]])
      )
    end
    # or else data not found in attributes(hash), not an issue as the data can be optional
  end

  self
end

#eql?(other) ⇒ Boolean

Parameters:

  • other (Object)

    the other object to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


177
178
179
# File 'lib/oci/generative_ai_agent_runtime/models/trace.rb', line 177

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



186
187
188
# File 'lib/oci/generative_ai_agent_runtime/models/trace.rb', line 186

def hash
  [key, parent_key, source, time_created, time_finished, trace_type].hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



230
231
232
233
234
235
236
237
238
239
# File 'lib/oci/generative_ai_agent_runtime/models/trace.rb', line 230

def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = public_method(attr).call
    next if value.nil? && !instance_variable_defined?("@#{attr}")

    hash[param] = _to_hash(value)
  end
  hash
end

#to_sString

Returns the string representation of the object

Returns:

  • (String)

    String presentation of the object



224
225
226
# File 'lib/oci/generative_ai_agent_runtime/models/trace.rb', line 224

def to_s
  to_hash.to_s
end