Class: Vellum::SpanLink
- Inherits:
-
Object
- Object
- Vellum::SpanLink
- Defined in:
- lib/vellum_ai/types/span_link.rb
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
- #span_context ⇒ Vellum::ParentContext readonly
- #trace_id ⇒ String readonly
- #type ⇒ Vellum::SpanLinkTypeEnum readonly
Class Method Summary collapse
Instance Method Summary collapse
- #initialize(trace_id:, type:, span_context:, additional_properties: nil) ⇒ Vellum::SpanLink constructor
- #to_json ⇒ String
Constructor Details
#initialize(trace_id:, type:, span_context:, additional_properties: nil) ⇒ Vellum::SpanLink
28 29 30 31 32 33 34 |
# File 'lib/vellum_ai/types/span_link.rb', line 28 def initialize(trace_id:, type:, span_context:, additional_properties: nil) @trace_id = trace_id @type = type @span_context = span_context @additional_properties = additional_properties @_field_set = { "trace_id": trace_id, "type": type, "span_context": span_context } end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
16 17 18 |
# File 'lib/vellum_ai/types/span_link.rb', line 16 def additional_properties @additional_properties end |
#span_context ⇒ Vellum::ParentContext (readonly)
14 15 16 |
# File 'lib/vellum_ai/types/span_link.rb', line 14 def span_context @span_context end |
#trace_id ⇒ String (readonly)
10 11 12 |
# File 'lib/vellum_ai/types/span_link.rb', line 10 def trace_id @trace_id end |
#type ⇒ Vellum::SpanLinkTypeEnum (readonly)
12 13 14 |
# File 'lib/vellum_ai/types/span_link.rb', line 12 def type @type end |
Class Method Details
.from_json(json_object:) ⇒ Vellum::SpanLink
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/vellum_ai/types/span_link.rb', line 39 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) trace_id = parsed_json["trace_id"] type = parsed_json["type"] unless parsed_json["span_context"].nil? span_context = parsed_json["span_context"].to_json span_context = Vellum::ParentContext.from_json(json_object: span_context) else span_context = nil end new( trace_id: trace_id, type: type, span_context: span_context, additional_properties: struct ) end |
.validate_raw(obj:) ⇒ Void
69 70 71 72 73 |
# File 'lib/vellum_ai/types/span_link.rb', line 69 def self.validate_raw(obj:) obj.trace_id.is_a?(String) != false || raise("Passed value for field obj.trace_id is not the expected type, validation failed.") obj.type.is_a?(Vellum::SpanLinkTypeEnum) != false || raise("Passed value for field obj.type is not the expected type, validation failed.") Vellum::ParentContext.validate_raw(obj: obj.span_context) end |
Instance Method Details
#to_json ⇒ String
60 61 62 |
# File 'lib/vellum_ai/types/span_link.rb', line 60 def to_json @_field_set&.to_json end |