Class: Vellum::ApiRequestParentContext

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

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(parent: OMIT, links: OMIT, type:, span_id:, api_actor_id: OMIT, api_actor_type: OMIT, api_actor_label: OMIT, additional_properties: nil) ⇒ Vellum::ApiRequestParentContext

Parameters:

  • parent (Vellum::ParentContext) (defaults to: OMIT)
  • links (Array<Vellum::SpanLink>) (defaults to: OMIT)
  • type (String)
  • span_id (String)
  • api_actor_id (String) (defaults to: OMIT)
  • api_actor_type (Vellum::ApiActorTypeEnum) (defaults to: OMIT)
  • api_actor_label (String) (defaults to: OMIT)
  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/vellum_ai/types/api_request_parent_context.rb', line 41

def initialize(parent: OMIT, links: OMIT, type:, span_id:, api_actor_id: OMIT, api_actor_type: OMIT, api_actor_label: OMIT, additional_properties: nil)
  @parent = parent if parent != OMIT
  @links = links if links != OMIT
  @type = type
  @span_id = span_id
  @api_actor_id = api_actor_id if api_actor_id != OMIT
  @api_actor_type = api_actor_type if api_actor_type != OMIT
  @api_actor_label = api_actor_label if api_actor_label != OMIT
  @additional_properties = additional_properties
  @_field_set = { "parent": parent, "links": links, "type": type, "span_id": span_id, "api_actor_id": api_actor_id, "api_actor_type": api_actor_type, "api_actor_label": api_actor_label }.reject do | _k, v |
  v == OMIT
end
end

Instance Attribute Details

#additional_propertiesOpenStruct (readonly)

Returns Additional properties unmapped to the current class definition.

Returns:

  • (OpenStruct)

    Additional properties unmapped to the current class definition



25
26
27
# File 'lib/vellum_ai/types/api_request_parent_context.rb', line 25

def additional_properties
  @additional_properties
end

#api_actor_idString (readonly)

Returns:

  • (String)


19
20
21
# File 'lib/vellum_ai/types/api_request_parent_context.rb', line 19

def api_actor_id
  @api_actor_id
end

#api_actor_labelString (readonly)

Returns:

  • (String)


23
24
25
# File 'lib/vellum_ai/types/api_request_parent_context.rb', line 23

def api_actor_label
  @api_actor_label
end

#api_actor_typeVellum::ApiActorTypeEnum (readonly)



21
22
23
# File 'lib/vellum_ai/types/api_request_parent_context.rb', line 21

def api_actor_type
  @api_actor_type
end

Returns:



13
14
15
# File 'lib/vellum_ai/types/api_request_parent_context.rb', line 13

def links
  @links
end

#parentVellum::ParentContext (readonly)



11
12
13
# File 'lib/vellum_ai/types/api_request_parent_context.rb', line 11

def parent
  @parent
end

#span_idString (readonly)

Returns:

  • (String)


17
18
19
# File 'lib/vellum_ai/types/api_request_parent_context.rb', line 17

def span_id
  @span_id
end

#typeString (readonly)

Returns:

  • (String)


15
16
17
# File 'lib/vellum_ai/types/api_request_parent_context.rb', line 15

def type
  @type
end

Class Method Details

.from_json(json_object:) ⇒ Vellum::ApiRequestParentContext

Parameters:

  • json_object (String)

Returns:



58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# File 'lib/vellum_ai/types/api_request_parent_context.rb', line 58

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  unless parsed_json["parent"].nil?
    parent = parsed_json["parent"].to_json
    parent = Vellum::ParentContext.from_json(json_object: parent)
  else
    parent = nil
  end
  links = parsed_json["links"]&.map do | item |
  item = item.to_json
  Vellum::SpanLink.from_json(json_object: item)
end
  type = parsed_json["type"]
  span_id = parsed_json["span_id"]
  api_actor_id = parsed_json["api_actor_id"]
  api_actor_type = parsed_json["api_actor_type"]
  api_actor_label = parsed_json["api_actor_label"]
  new(
    parent: parent,
    links: links,
    type: type,
    span_id: span_id,
    api_actor_id: api_actor_id,
    api_actor_type: api_actor_type,
    api_actor_label: api_actor_label,
    additional_properties: struct
  )
end

.validate_raw(obj:) ⇒ Void

Parameters:

  • obj (Object)

Returns:

  • (Void)


99
100
101
102
103
104
105
106
107
# File 'lib/vellum_ai/types/api_request_parent_context.rb', line 99

def self.validate_raw(obj:)
  obj.parent.nil? || Vellum::ParentContext.validate_raw(obj: obj.parent)
  obj.links&.is_a?(Array) != false || raise("Passed value for field obj.links is not the expected type, validation failed.")
  obj.type.is_a?(String) != false || raise("Passed value for field obj.type is not the expected type, validation failed.")
  obj.span_id.is_a?(String) != false || raise("Passed value for field obj.span_id is not the expected type, validation failed.")
  obj.api_actor_id&.is_a?(String) != false || raise("Passed value for field obj.api_actor_id is not the expected type, validation failed.")
  obj.api_actor_type&.is_a?(Vellum::ApiActorTypeEnum) != false || raise("Passed value for field obj.api_actor_type is not the expected type, validation failed.")
  obj.api_actor_label&.is_a?(String) != false || raise("Passed value for field obj.api_actor_label is not the expected type, validation failed.")
end

Instance Method Details

#to_jsonString

Returns:

  • (String)


90
91
92
# File 'lib/vellum_ai/types/api_request_parent_context.rb', line 90

def to_json
  @_field_set&.to_json
end