Class: Mindee::Parsing::V2::Inference
- Inherits:
-
Object
- Object
- Mindee::Parsing::V2::Inference
- Defined in:
- lib/mindee/parsing/v2/inference.rb
Overview
Complete data returned by an inference request.
Instance Attribute Summary collapse
-
#active_options ⇒ InferenceActiveOptions
readonly
Options which were activated during the inference.
-
#file ⇒ InferenceFile
readonly
Information about the processed file.
-
#id ⇒ String
readonly
Identifier of the inference (when provided by API).
-
#model ⇒ InferenceModel
readonly
Information about the model used.
-
#result ⇒ InferenceResult
readonly
Result contents.
Instance Method Summary collapse
-
#initialize(server_response) ⇒ Inference
constructor
A new instance of Inference.
-
#to_s ⇒ String
String representation.
Constructor Details
#initialize(server_response) ⇒ Inference
Returns a new instance of Inference.
25 26 27 28 29 30 31 32 33 34 |
# File 'lib/mindee/parsing/v2/inference.rb', line 25 def initialize(server_response) raise ArgumentError, 'server_response must be a Hash' unless server_response.is_a?(Hash) @model = InferenceModel.new(server_response['model']) @file = InferenceFile.new(server_response['file']) @active_options = InferenceActiveOptions.new(server_response['active_options']) @result = InferenceResult.new(server_response['result']) @id = server_response['id'] end |
Instance Attribute Details
#active_options ⇒ InferenceActiveOptions (readonly)
20 21 22 |
# File 'lib/mindee/parsing/v2/inference.rb', line 20 def @active_options end |
#file ⇒ InferenceFile (readonly)
18 19 20 |
# File 'lib/mindee/parsing/v2/inference.rb', line 18 def file @file end |
#id ⇒ String (readonly)
14 15 16 |
# File 'lib/mindee/parsing/v2/inference.rb', line 14 def id @id end |
#model ⇒ InferenceModel (readonly)
16 17 18 |
# File 'lib/mindee/parsing/v2/inference.rb', line 16 def model @model end |
#result ⇒ InferenceResult (readonly)
22 23 24 |
# File 'lib/mindee/parsing/v2/inference.rb', line 22 def result @result end |
Instance Method Details
#to_s ⇒ String
String representation.
38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/mindee/parsing/v2/inference.rb', line 38 def to_s [ 'Inference', '#########', @model.to_s, @file.to_s, @active_options.to_s, @result.to_s, '', ].join("\n") end |