Class: Cadenya::Resources::Objectives::ToolCalls
- Inherits:
-
Object
- Object
- Cadenya::Resources::Objectives::ToolCalls
- Defined in:
- lib/cadenya/resources/objectives/tool_calls.rb
Instance Method Summary collapse
-
#approve(tool_call_id, workspace_id:, objective_id:, request_options: {}) ⇒ Cadenya::Models::Objectives::ObjectiveToolCall
When an agent attempts to use a tool that requires approval, use this endpoint to mark it as approved.
-
#deny(tool_call_id, workspace_id:, objective_id:, memo: nil, request_options: {}) ⇒ Cadenya::Models::Objectives::ObjectiveToolCall
Some parameter documentations has been truncated, see Models::Objectives::ToolCallDenyParams for more details.
-
#initialize(client:) ⇒ ToolCalls
constructor
private
A new instance of ToolCalls.
-
#list(objective_id, workspace_id:, cursor: nil, include_info: nil, limit: nil, status: nil, request_options: {}) ⇒ Cadenya::Internal::CursorPagination<Cadenya::Models::Objectives::ObjectiveToolCall>
Lists all tool calls for an objective.
-
#retrieve(tool_call_id, workspace_id:, objective_id:, request_options: {}) ⇒ Cadenya::Models::Objectives::ObjectiveToolCallWithResult
Retrieves a single tool call, including the content the tool returned.
Constructor Details
#initialize(client:) ⇒ ToolCalls
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 ToolCalls.
172 173 174 |
# File 'lib/cadenya/resources/objectives/tool_calls.rb', line 172 def initialize(client:) @client = client end |
Instance Method Details
#approve(tool_call_id, workspace_id:, objective_id:, request_options: {}) ⇒ Cadenya::Models::Objectives::ObjectiveToolCall
When an agent attempts to use a tool that requires approval, use this endpoint to mark it as approved.
100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 |
# File 'lib/cadenya/resources/objectives/tool_calls.rb', line 100 def approve(tool_call_id, params) parsed, = Cadenya::Objectives::ToolCallApproveParams.dump_request(params) workspace_id = parsed.delete(:workspace_id) do raise ArgumentError.new("missing required path argument #{_1}") end objective_id = parsed.delete(:objective_id) do raise ArgumentError.new("missing required path argument #{_1}") end @client.request( method: :post, path: [ "v1/workspaces/%1$s/objectives/%2$s/tool_calls/%3$s:approve", workspace_id, objective_id, tool_call_id ], model: Cadenya::Objectives::ObjectiveToolCall, options: ) end |
#deny(tool_call_id, workspace_id:, objective_id:, memo: nil, request_options: {}) ⇒ Cadenya::Models::Objectives::ObjectiveToolCall
Some parameter documentations has been truncated, see Models::Objectives::ToolCallDenyParams for more details.
When an agent attempts to use a tool that requires approval, use this endpoint to mark it as denied. Use a memo to steer the LLM to a different decision or usage of the tool.
145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 |
# File 'lib/cadenya/resources/objectives/tool_calls.rb', line 145 def deny(tool_call_id, params) parsed, = Cadenya::Objectives::ToolCallDenyParams.dump_request(params) workspace_id = parsed.delete(:workspace_id) do raise ArgumentError.new("missing required path argument #{_1}") end objective_id = parsed.delete(:objective_id) do raise ArgumentError.new("missing required path argument #{_1}") end @client.request( method: :post, path: [ "v1/workspaces/%1$s/objectives/%2$s/tool_calls/%3$s:deny", workspace_id, objective_id, tool_call_id ], body: parsed, model: Cadenya::Objectives::ObjectiveToolCall, options: ) end |
#list(objective_id, workspace_id:, cursor: nil, include_info: nil, limit: nil, status: nil, request_options: {}) ⇒ Cadenya::Internal::CursorPagination<Cadenya::Models::Objectives::ObjectiveToolCall>
Lists all tool calls for an objective
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 |
# File 'lib/cadenya/resources/objectives/tool_calls.rb', line 67 def list(objective_id, params) parsed, = Cadenya::Objectives::ToolCallListParams.dump_request(params) query = Cadenya::Internal::Util.encode_query_params(parsed) workspace_id = parsed.delete(:workspace_id) do raise ArgumentError.new("missing required path argument #{_1}") end @client.request( method: :get, path: ["v1/workspaces/%1$s/objectives/%2$s/tool_calls", workspace_id, objective_id], query: query.transform_keys(include_info: "includeInfo"), page: Cadenya::Internal::CursorPagination, model: Cadenya::Objectives::ObjectiveToolCall, options: ) end |
#retrieve(tool_call_id, workspace_id:, objective_id:, request_options: {}) ⇒ Cadenya::Models::Objectives::ObjectiveToolCallWithResult
Retrieves a single tool call, including the content the tool returned. Media content (images, audio) is served as short-lived signed URLs.
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/cadenya/resources/objectives/tool_calls.rb', line 23 def retrieve(tool_call_id, params) parsed, = Cadenya::Objectives::ToolCallRetrieveParams.dump_request(params) workspace_id = parsed.delete(:workspace_id) do raise ArgumentError.new("missing required path argument #{_1}") end objective_id = parsed.delete(:objective_id) do raise ArgumentError.new("missing required path argument #{_1}") end @client.request( method: :get, path: [ "v1/workspaces/%1$s/objectives/%2$s/tool_calls/%3$s", workspace_id, objective_id, tool_call_id ], model: Cadenya::Objectives::ObjectiveToolCallWithResult, options: ) end |