Class: Vellum::MetadataFilterConfigRequest
- Inherits:
-
Object
- Object
- Vellum::MetadataFilterConfigRequest
- Defined in:
- lib/vellum_ai/types/metadata_filter_config_request.rb
Instance Attribute Summary collapse
-
#additional_properties ⇒ Object
readonly
Returns the value of attribute additional_properties.
-
#combinator ⇒ Object
readonly
Returns the value of attribute combinator.
-
#field ⇒ Object
readonly
Returns the value of attribute field.
-
#negated ⇒ Object
readonly
Returns the value of attribute negated.
-
#operator ⇒ Object
readonly
Returns the value of attribute operator.
-
#rules ⇒ Object
readonly
Returns the value of attribute rules.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Class Method Summary collapse
-
.from_json(json_object:) ⇒ MetadataFilterConfigRequest
Deserialize a JSON object to an instance of MetadataFilterConfigRequest.
-
.validate_raw(obj:) ⇒ Void
Leveraged for Union-type generation, validate_raw attempts to parse the given hash and check each fields type against the current object’s property definitions.
Instance Method Summary collapse
- #initialize(combinator: nil, negated: nil, rules: nil, field: nil, operator: nil, value: nil, additional_properties: nil) ⇒ MetadataFilterConfigRequest constructor
-
#to_json(*_args) ⇒ JSON
Serialize an instance of MetadataFilterConfigRequest to a JSON object.
Constructor Details
#initialize(combinator: nil, negated: nil, rules: nil, field: nil, operator: nil, value: nil, additional_properties: nil) ⇒ MetadataFilterConfigRequest
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/vellum_ai/types/metadata_filter_config_request.rb', line 20 def initialize(combinator: nil, negated: nil, rules: nil, field: nil, operator: nil, value: nil, additional_properties: nil) # @type [METADATA_FILTER_RULE_COMBINATOR] @combinator = combinator # @type [Boolean] @negated = negated # @type [Array<MetadataFilterRuleRequest>] @rules = rules # @type [String] @field = field # @type [LOGICAL_OPERATOR] @operator = operator # @type [String] @value = value # @type [OpenStruct] Additional properties unmapped to the current class definition @additional_properties = additional_properties end |
Instance Attribute Details
#additional_properties ⇒ Object (readonly)
Returns the value of attribute additional_properties.
10 11 12 |
# File 'lib/vellum_ai/types/metadata_filter_config_request.rb', line 10 def additional_properties @additional_properties end |
#combinator ⇒ Object (readonly)
Returns the value of attribute combinator.
10 11 12 |
# File 'lib/vellum_ai/types/metadata_filter_config_request.rb', line 10 def combinator @combinator end |
#field ⇒ Object (readonly)
Returns the value of attribute field.
10 11 12 |
# File 'lib/vellum_ai/types/metadata_filter_config_request.rb', line 10 def field @field end |
#negated ⇒ Object (readonly)
Returns the value of attribute negated.
10 11 12 |
# File 'lib/vellum_ai/types/metadata_filter_config_request.rb', line 10 def negated @negated end |
#operator ⇒ Object (readonly)
Returns the value of attribute operator.
10 11 12 |
# File 'lib/vellum_ai/types/metadata_filter_config_request.rb', line 10 def operator @operator end |
#rules ⇒ Object (readonly)
Returns the value of attribute rules.
10 11 12 |
# File 'lib/vellum_ai/types/metadata_filter_config_request.rb', line 10 def rules @rules end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
10 11 12 |
# File 'lib/vellum_ai/types/metadata_filter_config_request.rb', line 10 def value @value end |
Class Method Details
.from_json(json_object:) ⇒ MetadataFilterConfigRequest
Deserialize a JSON object to an instance of MetadataFilterConfigRequest
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/vellum_ai/types/metadata_filter_config_request.rb', line 42 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) combinator = METADATA_FILTER_RULE_COMBINATOR.key(parsed_json["combinator"]) || parsed_json["combinator"] negated = struct.negated rules = parsed_json["rules"].map do |v| v = v.to_json MetadataFilterRuleRequest.from_json(json_object: v) end field = struct.field operator = LOGICAL_OPERATOR.key(parsed_json["operator"]) || parsed_json["operator"] value = struct.value new(combinator: combinator, negated: negated, rules: rules, field: field, operator: operator, value: value, additional_properties: struct) end |
.validate_raw(obj:) ⇒ Void
Leveraged for Union-type generation, validate_raw attempts to parse the given hash and check each fields type against the current object’s property definitions.
76 77 78 79 80 81 82 83 |
# File 'lib/vellum_ai/types/metadata_filter_config_request.rb', line 76 def self.validate_raw(obj:) obj.combinator&.is_a?(METADATA_FILTER_RULE_COMBINATOR) != 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?(LOGICAL_OPERATOR) != 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_json(*_args) ⇒ JSON
Serialize an instance of MetadataFilterConfigRequest to a JSON object
61 62 63 64 65 66 67 68 69 70 |
# File 'lib/vellum_ai/types/metadata_filter_config_request.rb', line 61 def to_json(*_args) { "combinator": METADATA_FILTER_RULE_COMBINATOR[@combinator] || @combinator, "negated": @negated, "rules": @rules, "field": @field, "operator": LOGICAL_OPERATOR[@operator] || @operator, "value": @value }.to_json end |