Class: Handinger::Resources::Tasks
- Inherits:
-
Object
- Object
- Handinger::Resources::Tasks
- Defined in:
- lib/handinger/resources/tasks.rb
Overview
Run and inspect tasks against a worker.
Instance Method Summary collapse
-
#create(worker_id:, instructions: nil, output_schema: nil, prompt: nil, summary: nil, task_id: nil, title: nil, visibility: nil, request_options: {}) ⇒ Handinger::Models::Worker
Some parameter documentations has been truncated, see Models::TaskCreateParams for more details.
-
#initialize(client:) ⇒ Tasks
constructor
private
A new instance of Tasks.
-
#retrieve(task_id, request_options: {}) ⇒ Handinger::Models::TaskWithTurns
Retrieve a single task and its individual turns.
Constructor Details
#initialize(client:) ⇒ Tasks
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Tasks.
71 72 73 |
# File 'lib/handinger/resources/tasks.rb', line 71 def initialize(client:) @client = client end |
Instance Method Details
#create(worker_id:, instructions: nil, output_schema: nil, prompt: nil, summary: nil, task_id: nil, title: nil, visibility: nil, request_options: {}) ⇒ Handinger::Models::Worker
Some parameter documentations has been truncated, see Models::TaskCreateParams for more details.
Run a new task against an existing worker. Send ‘multipart/form-data` to attach files; the bytes are bootstrapped into the worker’s workspace before the task starts.
37 38 39 40 41 42 43 44 45 46 |
# File 'lib/handinger/resources/tasks.rb', line 37 def create(params) parsed, = Handinger::TaskCreateParams.dump_request(params) @client.request( method: :post, path: "api/tasks", body: parsed, model: Handinger::Worker, options: ) end |
#retrieve(task_id, request_options: {}) ⇒ Handinger::Models::TaskWithTurns
Retrieve a single task and its individual turns.
59 60 61 62 63 64 65 66 |
# File 'lib/handinger/resources/tasks.rb', line 59 def retrieve(task_id, params = {}) @client.request( method: :get, path: ["api/tasks/%1$s", task_id], model: Handinger::TaskWithTurns, options: params[:request_options] ) end |