Class: Vellum::SearchRequestOptionsRequest
- Inherits:
-
Object
- Object
- Vellum::SearchRequestOptionsRequest
- Defined in:
- lib/vellum_ai/types/search_request_options_request.rb
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
-
#filters ⇒ Vellum::SearchFiltersRequest
readonly
The filters to apply to the search.
-
#limit ⇒ Integer
readonly
The maximum number of results to return.
-
#result_merging ⇒ Vellum::SearchResultMergingRequest
readonly
The configuration for merging results.
-
#weights ⇒ Vellum::SearchWeightsRequest
readonly
The weights to use for the search.
Class Method Summary collapse
Instance Method Summary collapse
- #initialize(limit: OMIT, weights: OMIT, result_merging: OMIT, filters: OMIT, additional_properties: nil) ⇒ Vellum::SearchRequestOptionsRequest constructor
- #to_json ⇒ String
Constructor Details
#initialize(limit: OMIT, weights: OMIT, result_merging: OMIT, filters: OMIT, additional_properties: nil) ⇒ Vellum::SearchRequestOptionsRequest
32 33 34 35 36 37 38 39 40 41 |
# File 'lib/vellum_ai/types/search_request_options_request.rb', line 32 def initialize(limit: OMIT, weights: OMIT, result_merging: OMIT, filters: OMIT, additional_properties: nil) @limit = limit if limit != OMIT @weights = weights if weights != OMIT @result_merging = result_merging if result_merging != OMIT @filters = filters if filters != OMIT @additional_properties = additional_properties @_field_set = { "limit": limit, "weights": weights, "result_merging": result_merging, "filters": filters }.reject do | _k, v | v == OMIT end end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
19 20 21 |
# File 'lib/vellum_ai/types/search_request_options_request.rb', line 19 def additional_properties @additional_properties end |
#filters ⇒ Vellum::SearchFiltersRequest (readonly)
Returns The filters to apply to the search.
17 18 19 |
# File 'lib/vellum_ai/types/search_request_options_request.rb', line 17 def filters @filters end |
#limit ⇒ Integer (readonly)
Returns The maximum number of results to return.
11 12 13 |
# File 'lib/vellum_ai/types/search_request_options_request.rb', line 11 def limit @limit end |
#result_merging ⇒ Vellum::SearchResultMergingRequest (readonly)
Returns The configuration for merging results.
15 16 17 |
# File 'lib/vellum_ai/types/search_request_options_request.rb', line 15 def result_merging @result_merging end |
#weights ⇒ Vellum::SearchWeightsRequest (readonly)
Returns The weights to use for the search. Must add up to 1.0.
13 14 15 |
# File 'lib/vellum_ai/types/search_request_options_request.rb', line 13 def weights @weights end |
Class Method Details
.from_json(json_object:) ⇒ Vellum::SearchRequestOptionsRequest
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/vellum_ai/types/search_request_options_request.rb', line 46 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) limit = parsed_json["limit"] unless parsed_json["weights"].nil? weights = parsed_json["weights"].to_json weights = Vellum::SearchWeightsRequest.from_json(json_object: weights) else weights = nil end unless parsed_json["result_merging"].nil? result_merging = parsed_json["result_merging"].to_json result_merging = Vellum::SearchResultMergingRequest.from_json(json_object: result_merging) else result_merging = nil end unless parsed_json["filters"].nil? filters = parsed_json["filters"].to_json filters = Vellum::SearchFiltersRequest.from_json(json_object: filters) else filters = nil end new( limit: limit, weights: weights, result_merging: result_merging, filters: filters, additional_properties: struct ) end |
.validate_raw(obj:) ⇒ Void
88 89 90 91 92 93 |
# File 'lib/vellum_ai/types/search_request_options_request.rb', line 88 def self.validate_raw(obj:) obj.limit&.is_a?(Integer) != false || raise("Passed value for field obj.limit is not the expected type, validation failed.") obj.weights.nil? || Vellum::SearchWeightsRequest.validate_raw(obj: obj.weights) obj.result_merging.nil? || Vellum::SearchResultMergingRequest.validate_raw(obj: obj.result_merging) obj.filters.nil? || Vellum::SearchFiltersRequest.validate_raw(obj: obj.filters) end |
Instance Method Details
#to_json ⇒ String
79 80 81 |
# File 'lib/vellum_ai/types/search_request_options_request.rb', line 79 def to_json @_field_set&.to_json end |