Class: Vellum::SearchResultDocumentRequest
- Inherits:
-
Object
- Object
- Vellum::SearchResultDocumentRequest
- Defined in:
- lib/vellum_ai/types/search_result_document_request.rb
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
-
#external_id ⇒ Object
readonly
when it was originally uploaded.
-
#id ⇒ String
readonly
The ID of the document.
-
#label ⇒ String
readonly
The human-readable name for the document.
-
#metadata ⇒ Object
readonly
when searching.
Class Method Summary collapse
Instance Method Summary collapse
- #initialize(id: OMIT, label:, external_id: OMIT, metadata: OMIT, additional_properties: nil) ⇒ Vellum::SearchResultDocumentRequest constructor
- #to_json ⇒ String
Constructor Details
#initialize(id: OMIT, label:, external_id: OMIT, metadata: OMIT, additional_properties: nil) ⇒ Vellum::SearchResultDocumentRequest
33 34 35 36 37 38 39 40 41 42 |
# File 'lib/vellum_ai/types/search_result_document_request.rb', line 33 def initialize(id: OMIT, label:, external_id: OMIT, metadata: OMIT, additional_properties: nil) @id = id if id != OMIT @label = label @external_id = external_id if external_id != OMIT @metadata = if != OMIT @additional_properties = additional_properties @_field_set = { "id": id, "label": label, "external_id": external_id, "metadata": }.reject do | _k, v | v == OMIT end end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
18 19 20 |
# File 'lib/vellum_ai/types/search_result_document_request.rb', line 18 def additional_properties @additional_properties end |
#external_id ⇒ Object (readonly)
when it was originally uploaded.
13 14 15 |
# File 'lib/vellum_ai/types/search_result_document_request.rb', line 13 def external_id @external_id end |
#id ⇒ String (readonly)
Returns The ID of the document.
8 9 10 |
# File 'lib/vellum_ai/types/search_result_document_request.rb', line 8 def id @id end |
#label ⇒ String (readonly)
Returns The human-readable name for the document.
10 11 12 |
# File 'lib/vellum_ai/types/search_result_document_request.rb', line 10 def label @label end |
#metadata ⇒ Object (readonly)
when searching.
16 17 18 |
# File 'lib/vellum_ai/types/search_result_document_request.rb', line 16 def @metadata end |
Class Method Details
.from_json(json_object:) ⇒ Vellum::SearchResultDocumentRequest
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/vellum_ai/types/search_result_document_request.rb', line 47 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) id = parsed_json["id"] label = parsed_json["label"] external_id = parsed_json["external_id"] = parsed_json["metadata"] new( id: id, label: label, external_id: external_id, metadata: , additional_properties: struct ) end |
.validate_raw(obj:) ⇒ Void
74 75 76 77 78 79 |
# File 'lib/vellum_ai/types/search_result_document_request.rb', line 74 def self.validate_raw(obj:) obj.id&.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.") obj.label.is_a?(String) != false || raise("Passed value for field obj.label is not the expected type, validation failed.") obj.external_id&.is_a?(String) != false || raise("Passed value for field obj.external_id is not the expected type, validation failed.") obj.&.is_a?(Hash) != false || raise("Passed value for field obj.metadata is not the expected type, validation failed.") end |
Instance Method Details
#to_json ⇒ String
65 66 67 |
# File 'lib/vellum_ai/types/search_result_document_request.rb', line 65 def to_json @_field_set&.to_json end |