Class: Vellum::MetadataFilterConfigRequest

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

Overview

instead.

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(combinator: OMIT, negated: OMIT, rules: OMIT, field: OMIT, operator: OMIT, value: OMIT, additional_properties: nil) ⇒ Vellum::MetadataFilterConfigRequest

Parameters:



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

def initialize(combinator: OMIT, negated: OMIT, rules: OMIT, field: OMIT, operator: OMIT, value: OMIT, additional_properties: nil)
  @combinator = combinator if combinator != OMIT
  @negated = negated if negated != OMIT
  @rules = rules if rules != OMIT
  @field = field if field != OMIT
  @operator = operator if operator != OMIT
  @value = value if value != OMIT
  @additional_properties = additional_properties
  @_field_set = { "combinator": combinator, "negated": negated, "rules": rules, "field": field, "operator": operator, "value": value }.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/metadata_filter_config_request.rb', line 25

def additional_properties
  @additional_properties
end

#combinatorVellum::MetadataFilterRuleCombinator (readonly)



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

def combinator
  @combinator
end

#fieldString (readonly)

Returns:

  • (String)


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

def field
  @field
end

#negatedBoolean (readonly)

Returns:

  • (Boolean)


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

def negated
  @negated
end

#operatorVellum::LogicalOperator (readonly)



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

def operator
  @operator
end

#rulesArray<Vellum::MetadataFilterRuleRequest> (readonly)



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

def rules
  @rules
end

#valueString (readonly)

Returns:

  • (String)


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

def value
  @value
end

Class Method Details

.from_json(json_object:) ⇒ Vellum::MetadataFilterConfigRequest

Parameters:

  • json_object (String)

Returns:



56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# File 'lib/vellum_ai/types/metadata_filter_config_request.rb', line 56

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  combinator = parsed_json["combinator"]
  negated = parsed_json["negated"]
  rules = parsed_json["rules"]&.map do | item |
  item = item.to_json
  Vellum::MetadataFilterRuleRequest.from_json(json_object: item)
end
  field = parsed_json["field"]
  operator = parsed_json["operator"]
  value = parsed_json["value"]
  new(
    combinator: combinator,
    negated: negated,
    rules: rules,
    field: field,
    operator: operator,
    value: value,
    additional_properties: struct
  )
end

.validate_raw(obj:) ⇒ Void

Parameters:

  • obj (Object)

Returns:

  • (Void)


90
91
92
93
94
95
96
97
# File 'lib/vellum_ai/types/metadata_filter_config_request.rb', line 90

def self.validate_raw(obj:)
  obj.combinator&.is_a?(Vellum::MetadataFilterRuleCombinator) != 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.")
  obj.rules&.is_a?(Array) != false || raise("Passed value for field obj.rules is not the expected type, validation failed.")
  obj.field&.is_a?(String) != false || raise("Passed value for field obj.field is not the expected type, validation failed.")
  obj.operator&.is_a?(Vellum::LogicalOperator) != false || raise("Passed value for field obj.operator is not the expected type, validation failed.")
  obj.value&.is_a?(String) != false || raise("Passed value for field obj.value is not the expected type, validation failed.")
end

Instance Method Details

#to_jsonString

Returns:

  • (String)


81
82
83
# File 'lib/vellum_ai/types/metadata_filter_config_request.rb', line 81

def to_json
  @_field_set&.to_json
end