Class: Vellum::DocumentRead
- Inherits:
-
Object
- Object
- Vellum::DocumentRead
- Defined in:
- lib/vellum_ai/types/document_read.rb
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
- #document_to_document_indexes ⇒ Array<Vellum::DocumentDocumentToDocumentIndex> readonly
-
#external_id ⇒ String
readonly
The unique id of this document as it exists in the user’s system.
- #id ⇒ String readonly
-
#keywords ⇒ Object
readonly
keyword search.
-
#label ⇒ Object
readonly
file’s file name.
- #last_uploaded_at ⇒ DateTime readonly
-
#metadata ⇒ Object
readonly
when searching.
- #original_file_url ⇒ String readonly
- #processing_state ⇒ Vellum::DocumentProcessingState readonly
-
#status ⇒ Object
readonly
-
‘ACTIVE` - Active.
-
Class Method Summary collapse
Instance Method Summary collapse
- #initialize(id:, external_id: OMIT, last_uploaded_at:, label:, processing_state:, status: OMIT, keywords: OMIT, original_file_url: OMIT, document_to_document_indexes:, metadata: OMIT, additional_properties: nil) ⇒ Vellum::DocumentRead constructor
- #to_json ⇒ String
Constructor Details
#initialize(id:, external_id: OMIT, last_uploaded_at:, label:, processing_state:, status: OMIT, keywords: OMIT, original_file_url: OMIT, document_to_document_indexes:, metadata: OMIT, additional_properties: nil) ⇒ Vellum::DocumentRead
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
# File 'lib/vellum_ai/types/document_read.rb', line 59 def initialize(id:, external_id: OMIT, last_uploaded_at:, label:, processing_state:, status: OMIT, keywords: OMIT, original_file_url: OMIT, document_to_document_indexes:, metadata: OMIT, additional_properties: nil) @id = id @external_id = external_id if external_id != OMIT @last_uploaded_at = last_uploaded_at @label = label @processing_state = processing_state @status = status if status != OMIT @keywords = keywords if keywords != OMIT @original_file_url = original_file_url if original_file_url != OMIT @document_to_document_indexes = document_to_document_indexes @metadata = if != OMIT @additional_properties = additional_properties @_field_set = { "id": id, "external_id": external_id, "last_uploaded_at": last_uploaded_at, "label": label, "processing_state": processing_state, "status": status, "keywords": keywords, "original_file_url": original_file_url, "document_to_document_indexes": document_to_document_indexes, "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.
36 37 38 |
# File 'lib/vellum_ai/types/document_read.rb', line 36 def additional_properties @additional_properties end |
#document_to_document_indexes ⇒ Array<Vellum::DocumentDocumentToDocumentIndex> (readonly)
31 32 33 |
# File 'lib/vellum_ai/types/document_read.rb', line 31 def document_to_document_indexes @document_to_document_indexes end |
#external_id ⇒ String (readonly)
Returns The unique id of this document as it exists in the user’s system.
14 15 16 |
# File 'lib/vellum_ai/types/document_read.rb', line 14 def external_id @external_id end |
#id ⇒ String (readonly)
12 13 14 |
# File 'lib/vellum_ai/types/document_read.rb', line 12 def id @id end |
#keywords ⇒ Object (readonly)
keyword search.
27 28 29 |
# File 'lib/vellum_ai/types/document_read.rb', line 27 def keywords @keywords end |
#label ⇒ Object (readonly)
file’s file name.
19 20 21 |
# File 'lib/vellum_ai/types/document_read.rb', line 19 def label @label end |
#last_uploaded_at ⇒ DateTime (readonly)
16 17 18 |
# File 'lib/vellum_ai/types/document_read.rb', line 16 def last_uploaded_at @last_uploaded_at end |
#metadata ⇒ Object (readonly)
when searching.
34 35 36 |
# File 'lib/vellum_ai/types/document_read.rb', line 34 def @metadata end |
#original_file_url ⇒ String (readonly)
29 30 31 |
# File 'lib/vellum_ai/types/document_read.rb', line 29 def original_file_url @original_file_url end |
#processing_state ⇒ Vellum::DocumentProcessingState (readonly)
21 22 23 |
# File 'lib/vellum_ai/types/document_read.rb', line 21 def processing_state @processing_state end |
#status ⇒ Object (readonly)
-
‘ACTIVE` - Active
24 25 26 |
# File 'lib/vellum_ai/types/document_read.rb', line 24 def status @status end |
Class Method Details
.from_json(json_object:) ⇒ Vellum::DocumentRead
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 |
# File 'lib/vellum_ai/types/document_read.rb', line 79 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) id = parsed_json["id"] external_id = parsed_json["external_id"] last_uploaded_at = unless parsed_json["last_uploaded_at"].nil? DateTime.parse(parsed_json["last_uploaded_at"]) else nil end label = parsed_json["label"] processing_state = parsed_json["processing_state"] status = parsed_json["status"] keywords = parsed_json["keywords"] original_file_url = parsed_json["original_file_url"] document_to_document_indexes = parsed_json["document_to_document_indexes"]&.map do | item | item = item.to_json Vellum::DocumentDocumentToDocumentIndex.from_json(json_object: item) end = parsed_json["metadata"] new( id: id, external_id: external_id, last_uploaded_at: last_uploaded_at, label: label, processing_state: processing_state, status: status, keywords: keywords, original_file_url: original_file_url, document_to_document_indexes: document_to_document_indexes, metadata: , additional_properties: struct ) end |
.validate_raw(obj:) ⇒ Void
125 126 127 128 129 130 131 132 133 134 135 136 |
# File 'lib/vellum_ai/types/document_read.rb', line 125 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.external_id&.is_a?(String) != false || raise("Passed value for field obj.external_id is not the expected type, validation failed.") obj.last_uploaded_at.is_a?(DateTime) != false || raise("Passed value for field obj.last_uploaded_at 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.processing_state.is_a?(Vellum::DocumentProcessingState) != false || raise("Passed value for field obj.processing_state is not the expected type, validation failed.") obj.status&.is_a?(String) != false || raise("Passed value for field obj.status is not the expected type, validation failed.") obj.keywords&.is_a?(Array) != false || raise("Passed value for field obj.keywords is not the expected type, validation failed.") obj.original_file_url&.is_a?(String) != false || raise("Passed value for field obj.original_file_url is not the expected type, validation failed.") obj.document_to_document_indexes.is_a?(Array) != false || raise("Passed value for field obj.document_to_document_indexes 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
116 117 118 |
# File 'lib/vellum_ai/types/document_read.rb', line 116 def to_json @_field_set&.to_json end |