Class: Vellum::VellumValueLogicalConditionGroupRequest

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

Overview

higher-order conditions.

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type:, conditions:, combinator:, negated:, additional_properties: nil) ⇒ Vellum::VellumValueLogicalConditionGroupRequest

Parameters:



33
34
35
36
37
38
39
40
# File 'lib/vellum_ai/types/vellum_value_logical_condition_group_request.rb', line 33

def initialize(type:, conditions:, combinator:, negated:, additional_properties: nil)
  @type = type
  @conditions = conditions
  @combinator = combinator
  @negated = negated
  @additional_properties = additional_properties
  @_field_set = { "type": type, "conditions": conditions, "combinator": combinator, "negated": negated }
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



20
21
22
# File 'lib/vellum_ai/types/vellum_value_logical_condition_group_request.rb', line 20

def additional_properties
  @additional_properties
end

#combinatorVellum::ConditionCombinator (readonly)



16
17
18
# File 'lib/vellum_ai/types/vellum_value_logical_condition_group_request.rb', line 16

def combinator
  @combinator
end

#conditionsArray<Vellum::VellumValueLogicalExpressionRequest> (readonly)



14
15
16
# File 'lib/vellum_ai/types/vellum_value_logical_condition_group_request.rb', line 14

def conditions
  @conditions
end

#negatedBoolean (readonly)

Returns:

  • (Boolean)


18
19
20
# File 'lib/vellum_ai/types/vellum_value_logical_condition_group_request.rb', line 18

def negated
  @negated
end

#typeString (readonly)

Returns:

  • (String)


12
13
14
# File 'lib/vellum_ai/types/vellum_value_logical_condition_group_request.rb', line 12

def type
  @type
end

Class Method Details

.from_json(json_object:) ⇒ Vellum::VellumValueLogicalConditionGroupRequest

Parameters:

  • json_object (String)

Returns:



46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/vellum_ai/types/vellum_value_logical_condition_group_request.rb', line 46

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  type = parsed_json["type"]
  conditions = parsed_json["conditions"]&.map do | item |
  item = item.to_json
  Vellum::VellumValueLogicalExpressionRequest.from_json(json_object: item)
end
  combinator = parsed_json["combinator"]
  negated = parsed_json["negated"]
  new(
    type: type,
    conditions: conditions,
    combinator: combinator,
    negated: negated,
    additional_properties: struct
  )
end

.validate_raw(obj:) ⇒ Void

Parameters:

  • obj (Object)

Returns:

  • (Void)


77
78
79
80
81
82
# File 'lib/vellum_ai/types/vellum_value_logical_condition_group_request.rb', line 77

def self.validate_raw(obj:)
  obj.type.is_a?(String) != false || raise("Passed value for field obj.type is not the expected type, validation failed.")
  obj.conditions.is_a?(Array) != false || raise("Passed value for field obj.conditions is not the expected type, validation failed.")
  obj.combinator.is_a?(Vellum::ConditionCombinator) != false || raise("Passed value for field obj.combinator is not the expected type, validation failed.")
  obj.negated.is_a?(Boolean) != false || raise("Passed value for field obj.negated is not the expected type, validation failed.")
end

Instance Method Details

#to_jsonString

Returns:

  • (String)


68
69
70
# File 'lib/vellum_ai/types/vellum_value_logical_condition_group_request.rb', line 68

def to_json
  @_field_set&.to_json
end