Class: Exa::Services::AgentRunList
- Inherits:
-
Object
- Object
- Exa::Services::AgentRunList
- Defined in:
- lib/exa/services/agent_run_list.rb
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(connection, **params) ⇒ AgentRunList
constructor
A new instance of AgentRunList.
Constructor Details
#initialize(connection, **params) ⇒ AgentRunList
Returns a new instance of AgentRunList.
9 10 11 12 |
# File 'lib/exa/services/agent_run_list.rb', line 9 def initialize(connection, **params) @connection = connection @params = params end |
Instance Method Details
#call ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/exa/services/agent_run_list.rb', line 14 def call response = @connection.get("/agent/runs", @params) body = response.body data = body["data"].map do |run_data| Resources::AgentRun.new( id: run_data["id"], object: run_data["object"], status: run_data["status"], stop_reason: run_data["stopReason"], created_at: run_data["createdAt"], completed_at: run_data["completedAt"], request: run_data["request"], output: run_data["output"], usage: run_data["usage"], cost_dollars: run_data["costDollars"] ) end Resources::AgentRunList.new( data: data, has_more: body["hasMore"], next_cursor: body["nextCursor"] ) end |