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.
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.
133 134 135 |
# File 'lib/cadenya/resources/objectives/tool_calls.rb', line 133 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.
61 62 63 64 65 66 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 61 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: :put, 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.
106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 |
# File 'lib/cadenya/resources/objectives/tool_calls.rb', line 106 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: :put, 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
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/cadenya/resources/objectives/tool_calls.rb', line 28 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 |