Class: Openlayer::InferencePipeline
- Inherits:
-
Object
- Object
- Openlayer::InferencePipeline
- Defined in:
- lib/openlayer/inference_pipeline.rb
Instance Attribute Summary collapse
-
#client ⇒ Object
readonly
Returns the value of attribute client.
-
#inference_pipeline_id ⇒ Object
readonly
Returns the value of attribute inference_pipeline_id.
Instance Method Summary collapse
- #handle_response(response) ⇒ Object
-
#initialize(client, inference_pipeline_id) ⇒ InferencePipeline
constructor
A new instance of InferencePipeline.
- #stream_data(body = {}) ⇒ Object
Constructor Details
#initialize(client, inference_pipeline_id) ⇒ InferencePipeline
Returns a new instance of InferencePipeline.
7 8 9 10 |
# File 'lib/openlayer/inference_pipeline.rb', line 7 def initialize(client, inference_pipeline_id) @client = client @inference_pipeline_id = inference_pipeline_id end |
Instance Attribute Details
#client ⇒ Object (readonly)
Returns the value of attribute client.
5 6 7 |
# File 'lib/openlayer/inference_pipeline.rb', line 5 def client @client end |
#inference_pipeline_id ⇒ Object (readonly)
Returns the value of attribute inference_pipeline_id.
5 6 7 |
# File 'lib/openlayer/inference_pipeline.rb', line 5 def inference_pipeline_id @inference_pipeline_id end |
Instance Method Details
#handle_response(response) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/openlayer/inference_pipeline.rb', line 17 def handle_response(response) = response.body["error"] case response.status when 200 response.body when 401 raise Error, when 404 raise Error, when 422 raise Error, when 500 raise Error, else raise Error, end response end |
#stream_data(body = {}) ⇒ Object
12 13 14 15 |
# File 'lib/openlayer/inference_pipeline.rb', line 12 def stream_data(body = {}) handle_response client.connection.post("inference-pipelines/#{inference_pipeline_id}/data-stream", body) true end |