Class: Vellum::PdfSearchResultMetaSource
- Inherits:
-
Object
- Object
- Vellum::PdfSearchResultMetaSource
- Defined in:
- lib/vellum_ai/types/pdf_search_result_meta_source.rb
Overview
The source of a search result from a PDF document.
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
- #document_type ⇒ String readonly
-
#end_page_num ⇒ Object
readonly
for supported chunking strategies and document types.
-
#start_page_num ⇒ Object
readonly
for supported chunking strategies and document types.
Class Method Summary collapse
Instance Method Summary collapse
- #initialize(document_type:, start_page_num: OMIT, end_page_num: OMIT, additional_properties: nil) ⇒ Vellum::PdfSearchResultMetaSource constructor
- #to_json ⇒ String
Constructor Details
#initialize(document_type:, start_page_num: OMIT, end_page_num: OMIT, additional_properties: nil) ⇒ Vellum::PdfSearchResultMetaSource
31 32 33 34 35 36 37 38 39 |
# File 'lib/vellum_ai/types/pdf_search_result_meta_source.rb', line 31 def initialize(document_type:, start_page_num: OMIT, end_page_num: OMIT, additional_properties: nil) @document_type = document_type @start_page_num = start_page_num if start_page_num != OMIT @end_page_num = end_page_num if end_page_num != OMIT @additional_properties = additional_properties @_field_set = { "document_type": document_type, "start_page_num": start_page_num, "end_page_num": end_page_num }.reject do | _k, v | v == OMIT end end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
17 18 19 |
# File 'lib/vellum_ai/types/pdf_search_result_meta_source.rb', line 17 def additional_properties @additional_properties end |
#document_type ⇒ String (readonly)
9 10 11 |
# File 'lib/vellum_ai/types/pdf_search_result_meta_source.rb', line 9 def document_type @document_type end |
#end_page_num ⇒ Object (readonly)
for supported chunking strategies and document types.
15 16 17 |
# File 'lib/vellum_ai/types/pdf_search_result_meta_source.rb', line 15 def end_page_num @end_page_num end |
#start_page_num ⇒ Object (readonly)
for supported chunking strategies and document types.
12 13 14 |
# File 'lib/vellum_ai/types/pdf_search_result_meta_source.rb', line 12 def start_page_num @start_page_num end |
Class Method Details
.from_json(json_object:) ⇒ Vellum::PdfSearchResultMetaSource
44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/vellum_ai/types/pdf_search_result_meta_source.rb', line 44 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) document_type = parsed_json["document_type"] start_page_num = parsed_json["start_page_num"] end_page_num = parsed_json["end_page_num"] new( document_type: document_type, start_page_num: start_page_num, end_page_num: end_page_num, additional_properties: struct ) end |
.validate_raw(obj:) ⇒ Void
69 70 71 72 73 |
# File 'lib/vellum_ai/types/pdf_search_result_meta_source.rb', line 69 def self.validate_raw(obj:) obj.document_type.is_a?(String) != false || raise("Passed value for field obj.document_type is not the expected type, validation failed.") obj.start_page_num&.is_a?(Integer) != false || raise("Passed value for field obj.start_page_num is not the expected type, validation failed.") obj.end_page_num&.is_a?(Integer) != false || raise("Passed value for field obj.end_page_num is not the expected type, validation failed.") end |
Instance Method Details
#to_json ⇒ String
60 61 62 |
# File 'lib/vellum_ai/types/pdf_search_result_meta_source.rb', line 60 def to_json @_field_set&.to_json end |