Class: Exa::Services::AgentRunCancel
- Inherits:
-
Object
- Object
- Exa::Services::AgentRunCancel
- Defined in:
- lib/exa/services/agent_run_cancel.rb
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(connection, run_id:) ⇒ AgentRunCancel
constructor
A new instance of AgentRunCancel.
Constructor Details
#initialize(connection, run_id:) ⇒ AgentRunCancel
Returns a new instance of AgentRunCancel.
8 9 10 11 |
# File 'lib/exa/services/agent_run_cancel.rb', line 8 def initialize(connection, run_id:) @connection = connection @run_id = run_id end |
Instance Method Details
#call ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/exa/services/agent_run_cancel.rb', line 13 def call response = @connection.post("/agent/runs/#{@run_id}/cancel", {}) body = response.body Resources::AgentRun.new( id: body["id"], object: body["object"], status: body["status"], stop_reason: body["stopReason"], created_at: body["createdAt"], completed_at: body["completedAt"], request: body["request"], output: body["output"], usage: body["usage"], cost_dollars: body["costDollars"] ) end |