Class: Vellum::SearchFiltersRequest
- Inherits:
-
Object
- Object
- Vellum::SearchFiltersRequest
- Defined in:
- lib/vellum_ai/types/search_filters_request.rb
Instance Attribute Summary collapse
-
#additional_properties ⇒ Object
readonly
Returns the value of attribute additional_properties.
-
#external_ids ⇒ Object
readonly
Returns the value of attribute external_ids.
-
#metadata ⇒ Object
readonly
Returns the value of attribute metadata.
Class Method Summary collapse
-
.from_json(json_object:) ⇒ SearchFiltersRequest
Deserialize a JSON object to an instance of SearchFiltersRequest.
-
.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(external_ids: nil, metadata: nil, additional_properties: nil) ⇒ SearchFiltersRequest constructor
-
#to_json(*_args) ⇒ JSON
Serialize an instance of SearchFiltersRequest to a JSON object.
Constructor Details
#initialize(external_ids: nil, metadata: nil, additional_properties: nil) ⇒ SearchFiltersRequest
14 15 16 17 18 19 20 21 |
# File 'lib/vellum_ai/types/search_filters_request.rb', line 14 def initialize(external_ids: nil, metadata: nil, additional_properties: nil) # @type [Array<String>] The document external IDs to filter by @external_ids = external_ids # @type [MetadataFilterConfigRequest] The metadata filters to apply to the search @metadata = # @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.
8 9 10 |
# File 'lib/vellum_ai/types/search_filters_request.rb', line 8 def additional_properties @additional_properties end |
#external_ids ⇒ Object (readonly)
Returns the value of attribute external_ids.
8 9 10 |
# File 'lib/vellum_ai/types/search_filters_request.rb', line 8 def external_ids @external_ids end |
#metadata ⇒ Object (readonly)
Returns the value of attribute metadata.
8 9 10 |
# File 'lib/vellum_ai/types/search_filters_request.rb', line 8 def @metadata end |
Class Method Details
.from_json(json_object:) ⇒ SearchFiltersRequest
Deserialize a JSON object to an instance of SearchFiltersRequest
27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/vellum_ai/types/search_filters_request.rb', line 27 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) external_ids = struct.external_ids if parsed_json["metadata"].nil? = nil else = parsed_json["metadata"].to_json = MetadataFilterConfigRequest.from_json(json_object: ) end new(external_ids: external_ids, metadata: , 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.
51 52 53 54 |
# File 'lib/vellum_ai/types/search_filters_request.rb', line 51 def self.validate_raw(obj:) obj.external_ids&.is_a?(Array) != false || raise("Passed value for field obj.external_ids is not the expected type, validation failed.") obj..nil? || MetadataFilterConfigRequest.validate_raw(obj: obj.) end |
Instance Method Details
#to_json(*_args) ⇒ JSON
Serialize an instance of SearchFiltersRequest to a JSON object
43 44 45 |
# File 'lib/vellum_ai/types/search_filters_request.rb', line 43 def to_json(*_args) { "external_ids": @external_ids, "metadata": @metadata }.to_json end |