Class: Exa::Services::AgentRunCreate
- Inherits:
-
Object
- Object
- Exa::Services::AgentRunCreate
- Defined in:
- lib/exa/services/agent_run_create.rb
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(connection, query:, **params) ⇒ AgentRunCreate
constructor
A new instance of AgentRunCreate.
Constructor Details
#initialize(connection, query:, **params) ⇒ AgentRunCreate
Returns a new instance of AgentRunCreate.
9 10 11 12 |
# File 'lib/exa/services/agent_run_create.rb', line 9 def initialize(connection, query:, **params) @connection = connection @params = params.merge(query: query) end |
Instance Method Details
#call ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/exa/services/agent_run_create.rb', line 14 def call response = @connection.post("/agent/runs", ParameterConverter.convert(@params)) 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 |