Class: Exa::Resources::ResearchTask
- Inherits:
-
Struct
- Object
- Struct
- Exa::Resources::ResearchTask
- Defined in:
- lib/exa/resources/research_task.rb
Instance Attribute Summary collapse
-
#cost_dollars ⇒ Object
Returns the value of attribute cost_dollars.
-
#created_at ⇒ Object
Returns the value of attribute created_at.
-
#error ⇒ Object
Returns the value of attribute error.
-
#events ⇒ Object
Returns the value of attribute events.
-
#finished_at ⇒ Object
Returns the value of attribute finished_at.
-
#instructions ⇒ Object
Returns the value of attribute instructions.
-
#model ⇒ Object
Returns the value of attribute model.
-
#output ⇒ Object
Returns the value of attribute output.
-
#output_schema ⇒ Object
Returns the value of attribute output_schema.
-
#research_id ⇒ Object
Returns the value of attribute research_id.
-
#status ⇒ Object
Returns the value of attribute status.
Instance Method Summary collapse
- #canceled? ⇒ Boolean
- #completed? ⇒ Boolean
- #failed? ⇒ Boolean
- #finished? ⇒ Boolean
-
#initialize(research_id:, created_at:, status:, instructions:, model: nil, output_schema: nil, events: nil, output: nil, cost_dollars: nil, finished_at: nil, error: nil) ⇒ ResearchTask
constructor
A new instance of ResearchTask.
- #pending? ⇒ Boolean
- #running? ⇒ Boolean
- #to_h ⇒ Object
Constructor Details
#initialize(research_id:, created_at:, status:, instructions:, model: nil, output_schema: nil, events: nil, output: nil, cost_dollars: nil, finished_at: nil, error: nil) ⇒ ResearchTask
Returns a new instance of ResearchTask.
8 9 10 11 |
# File 'lib/exa/resources/research_task.rb', line 8 def initialize(research_id:, created_at:, status:, instructions:, model: nil, output_schema: nil, events: nil, output: nil, cost_dollars: nil, finished_at: nil, error: nil) super freeze end |
Instance Attribute Details
#cost_dollars ⇒ Object
Returns the value of attribute cost_dollars
3 4 5 |
# File 'lib/exa/resources/research_task.rb', line 3 def cost_dollars @cost_dollars end |
#created_at ⇒ Object
Returns the value of attribute created_at
3 4 5 |
# File 'lib/exa/resources/research_task.rb', line 3 def created_at @created_at end |
#error ⇒ Object
Returns the value of attribute error
3 4 5 |
# File 'lib/exa/resources/research_task.rb', line 3 def error @error end |
#events ⇒ Object
Returns the value of attribute events
3 4 5 |
# File 'lib/exa/resources/research_task.rb', line 3 def events @events end |
#finished_at ⇒ Object
Returns the value of attribute finished_at
3 4 5 |
# File 'lib/exa/resources/research_task.rb', line 3 def finished_at @finished_at end |
#instructions ⇒ Object
Returns the value of attribute instructions
3 4 5 |
# File 'lib/exa/resources/research_task.rb', line 3 def instructions @instructions end |
#model ⇒ Object
Returns the value of attribute model
3 4 5 |
# File 'lib/exa/resources/research_task.rb', line 3 def model @model end |
#output ⇒ Object
Returns the value of attribute output
3 4 5 |
# File 'lib/exa/resources/research_task.rb', line 3 def output @output end |
#output_schema ⇒ Object
Returns the value of attribute output_schema
3 4 5 |
# File 'lib/exa/resources/research_task.rb', line 3 def output_schema @output_schema end |
#research_id ⇒ Object
Returns the value of attribute research_id
3 4 5 |
# File 'lib/exa/resources/research_task.rb', line 3 def research_id @research_id end |
#status ⇒ Object
Returns the value of attribute status
3 4 5 |
# File 'lib/exa/resources/research_task.rb', line 3 def status @status end |
Instance Method Details
#canceled? ⇒ Boolean
17 |
# File 'lib/exa/resources/research_task.rb', line 17 def canceled? = status == 'canceled' |
#completed? ⇒ Boolean
15 |
# File 'lib/exa/resources/research_task.rb', line 15 def completed? = status == 'completed' |
#failed? ⇒ Boolean
16 |
# File 'lib/exa/resources/research_task.rb', line 16 def failed? = status == 'failed' |
#finished? ⇒ Boolean
19 |
# File 'lib/exa/resources/research_task.rb', line 19 def finished? = !running? && !pending? |
#pending? ⇒ Boolean
13 |
# File 'lib/exa/resources/research_task.rb', line 13 def pending? = status == 'pending' |
#running? ⇒ Boolean
14 |
# File 'lib/exa/resources/research_task.rb', line 14 def running? = status == 'running' |
#to_h ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/exa/resources/research_task.rb', line 21 def to_h result = { research_id: research_id, created_at: created_at, status: status, instructions: instructions } result[:model] = model if model result[:output_schema] = output_schema if output_schema result[:events] = events if events result[:output] = output if output result[:cost_dollars] = cost_dollars if cost_dollars result[:finished_at] = finished_at if finished_at result[:error] = error if error result end |