cadenya 0.10.0 → 0.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +16 -0
- data/README.md +1 -1
- data/lib/cadenya/models/agents/agent_schedule_spec.rb +21 -10
- data/lib/cadenya/models/agents/agent_variation_spec.rb +18 -5
- data/lib/cadenya/models/objective.rb +11 -1
- data/lib/cadenya/models/objective_create_params.rb +19 -5
- data/lib/cadenya/models/objectives/objective_tool_call_data.rb +1 -9
- data/lib/cadenya/models/objectives/objective_tool_call_result.rb +27 -0
- data/lib/cadenya/models/objectives/objective_tool_call_result_audio_block.rb +46 -0
- data/lib/cadenya/models/objectives/objective_tool_call_result_content_block.rb +34 -0
- data/lib/cadenya/models/objectives/objective_tool_call_result_image_block.rb +46 -0
- data/lib/cadenya/models/objectives/objective_tool_call_result_text_block.rb +21 -0
- data/lib/cadenya/models/objectives/objective_tool_call_with_result.rb +102 -0
- data/lib/cadenya/models/objectives/tool_call_retrieve_params.rb +34 -0
- data/lib/cadenya/models/tool_result.rb +15 -7
- data/lib/cadenya/resources/objectives/tool_calls.rb +39 -0
- data/lib/cadenya/resources/objectives.rb +4 -2
- data/lib/cadenya/version.rb +1 -1
- data/lib/cadenya.rb +7 -0
- data/rbi/cadenya/models/agents/agent_schedule_spec.rbi +30 -10
- data/rbi/cadenya/models/agents/agent_variation_spec.rbi +29 -8
- data/rbi/cadenya/models/objective.rbi +14 -3
- data/rbi/cadenya/models/objective_create_params.rbi +25 -6
- data/rbi/cadenya/models/objectives/objective_tool_call_data.rbi +0 -11
- data/rbi/cadenya/models/objectives/objective_tool_call_result.rbi +54 -0
- data/rbi/cadenya/models/objectives/objective_tool_call_result_audio_block.rbi +69 -0
- data/rbi/cadenya/models/objectives/objective_tool_call_result_content_block.rbi +90 -0
- data/rbi/cadenya/models/objectives/objective_tool_call_result_image_block.rbi +69 -0
- data/rbi/cadenya/models/objectives/objective_tool_call_result_text_block.rbi +31 -0
- data/rbi/cadenya/models/objectives/objective_tool_call_with_result.rbi +219 -0
- data/rbi/cadenya/models/objectives/tool_call_retrieve_params.rbi +58 -0
- data/rbi/cadenya/models/tool_result.rbi +34 -12
- data/rbi/cadenya/resources/objectives/tool_calls.rbi +20 -0
- data/rbi/cadenya/resources/objectives.rbi +10 -3
- data/sig/cadenya/models/agents/agent_schedule_spec.rbs +14 -5
- data/sig/cadenya/models/agents/agent_variation_spec.rbs +12 -5
- data/sig/cadenya/models/objective.rbs +10 -3
- data/sig/cadenya/models/objective_create_params.rbs +7 -0
- data/sig/cadenya/models/objectives/objective_tool_call_data.rbs +0 -7
- data/sig/cadenya/models/objectives/objective_tool_call_result.rbs +24 -0
- data/sig/cadenya/models/objectives/objective_tool_call_result_audio_block.rbs +34 -0
- data/sig/cadenya/models/objectives/objective_tool_call_result_content_block.rbs +46 -0
- data/sig/cadenya/models/objectives/objective_tool_call_result_image_block.rbs +34 -0
- data/sig/cadenya/models/objectives/objective_tool_call_result_text_block.rbs +17 -0
- data/sig/cadenya/models/objectives/objective_tool_call_with_result.rbs +91 -0
- data/sig/cadenya/models/objectives/tool_call_retrieve_params.rbs +34 -0
- data/sig/cadenya/models/tool_result.rbs +15 -9
- data/sig/cadenya/resources/objectives/tool_calls.rbs +7 -0
- data/sig/cadenya/resources/objectives.rbs +1 -0
- metadata +23 -2
|
@@ -4,6 +4,45 @@ module Cadenya
|
|
|
4
4
|
module Resources
|
|
5
5
|
class Objectives
|
|
6
6
|
class ToolCalls
|
|
7
|
+
# Retrieves a single tool call, including the content the tool returned. Media
|
|
8
|
+
# content (images, audio) is served as short-lived signed URLs.
|
|
9
|
+
#
|
|
10
|
+
# @overload retrieve(tool_call_id, workspace_id:, objective_id:, request_options: {})
|
|
11
|
+
#
|
|
12
|
+
# @param tool_call_id [String] The ID of the tool call to retrieve
|
|
13
|
+
#
|
|
14
|
+
# @param workspace_id [String]
|
|
15
|
+
#
|
|
16
|
+
# @param objective_id [String] The ID of the objective. Supports "external_id:" prefix for external IDs.
|
|
17
|
+
#
|
|
18
|
+
# @param request_options [Cadenya::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
19
|
+
#
|
|
20
|
+
# @return [Cadenya::Models::Objectives::ObjectiveToolCallWithResult]
|
|
21
|
+
#
|
|
22
|
+
# @see Cadenya::Models::Objectives::ToolCallRetrieveParams
|
|
23
|
+
def retrieve(tool_call_id, params)
|
|
24
|
+
parsed, options = Cadenya::Objectives::ToolCallRetrieveParams.dump_request(params)
|
|
25
|
+
workspace_id =
|
|
26
|
+
parsed.delete(:workspace_id) do
|
|
27
|
+
raise ArgumentError.new("missing required path argument #{_1}")
|
|
28
|
+
end
|
|
29
|
+
objective_id =
|
|
30
|
+
parsed.delete(:objective_id) do
|
|
31
|
+
raise ArgumentError.new("missing required path argument #{_1}")
|
|
32
|
+
end
|
|
33
|
+
@client.request(
|
|
34
|
+
method: :get,
|
|
35
|
+
path: [
|
|
36
|
+
"v1/workspaces/%1$s/objectives/%2$s/tool_calls/%3$s",
|
|
37
|
+
workspace_id,
|
|
38
|
+
objective_id,
|
|
39
|
+
tool_call_id
|
|
40
|
+
],
|
|
41
|
+
model: Cadenya::Objectives::ObjectiveToolCallWithResult,
|
|
42
|
+
options: options
|
|
43
|
+
)
|
|
44
|
+
end
|
|
45
|
+
|
|
7
46
|
# Lists all tool calls for an objective
|
|
8
47
|
#
|
|
9
48
|
# @overload list(objective_id, workspace_id:, cursor: nil, include_info: nil, limit: nil, status: nil, request_options: {})
|
|
@@ -20,7 +20,7 @@ module Cadenya
|
|
|
20
20
|
#
|
|
21
21
|
# Creates a new objective in the workspace
|
|
22
22
|
#
|
|
23
|
-
# @overload create(workspace_id, agent_id:, data:, initial_message: nil, memory_stack: nil, metadata: nil, secrets: nil, variation_id: nil, request_options: {})
|
|
23
|
+
# @overload create(workspace_id, agent_id:, data:, initial_message: nil, memory_stack: nil, metadata: nil, secrets: nil, user_data: nil, variation_id: nil, request_options: {})
|
|
24
24
|
#
|
|
25
25
|
# @param workspace_id [String]
|
|
26
26
|
#
|
|
@@ -28,7 +28,7 @@ module Cadenya
|
|
|
28
28
|
#
|
|
29
29
|
# @param data [Hash{Symbol=>Object}] Arbitrary data for the objective. May be used in liquid templates for prompts co
|
|
30
30
|
#
|
|
31
|
-
# @param initial_message [String] Optional override for initial message sent to the agent. This becomes the
|
|
31
|
+
# @param initial_message [String] Optional override for the initial message sent to the agent. This becomes the fi
|
|
32
32
|
#
|
|
33
33
|
# @param memory_stack [Array<Cadenya::Models::MemoryReference>] Memory layers/entries to push onto this objective's memory stack on
|
|
34
34
|
#
|
|
@@ -36,6 +36,8 @@ module Cadenya
|
|
|
36
36
|
#
|
|
37
37
|
# @param secrets [Array<Cadenya::Models::ObjectiveCreateParams::Secret>] Secrets that can be used in the headers for tool calls using the secret interpol
|
|
38
38
|
#
|
|
39
|
+
# @param user_data [Hash{Symbol=>Object}] Arbitrary data rendered into the selected variation's user_message_template
|
|
40
|
+
#
|
|
39
41
|
# @param variation_id [String] Optional explicit variation selection. Overrides the agent's variation_selection
|
|
40
42
|
#
|
|
41
43
|
# @param request_options [Cadenya::RequestOptions, Hash{Symbol=>Object}, nil]
|
data/lib/cadenya/version.rb
CHANGED
data/lib/cadenya.rb
CHANGED
|
@@ -224,11 +224,18 @@ require_relative "cadenya/models/objectives/objective_tool"
|
|
|
224
224
|
require_relative "cadenya/models/objectives/objective_tool_call"
|
|
225
225
|
require_relative "cadenya/models/objectives/objective_tool_call_data"
|
|
226
226
|
require_relative "cadenya/models/objectives/objective_tool_call_info"
|
|
227
|
+
require_relative "cadenya/models/objectives/objective_tool_call_result"
|
|
228
|
+
require_relative "cadenya/models/objectives/objective_tool_call_result_audio_block"
|
|
229
|
+
require_relative "cadenya/models/objectives/objective_tool_call_result_content_block"
|
|
230
|
+
require_relative "cadenya/models/objectives/objective_tool_call_result_image_block"
|
|
231
|
+
require_relative "cadenya/models/objectives/objective_tool_call_result_text_block"
|
|
232
|
+
require_relative "cadenya/models/objectives/objective_tool_call_with_result"
|
|
227
233
|
require_relative "cadenya/models/objectives/task_list_params"
|
|
228
234
|
require_relative "cadenya/models/objectives/task_retrieve_params"
|
|
229
235
|
require_relative "cadenya/models/objectives/tool_call_approve_params"
|
|
230
236
|
require_relative "cadenya/models/objectives/tool_call_deny_params"
|
|
231
237
|
require_relative "cadenya/models/objectives/tool_call_list_params"
|
|
238
|
+
require_relative "cadenya/models/objectives/tool_call_retrieve_params"
|
|
232
239
|
require_relative "cadenya/models/objectives/tool_list_params"
|
|
233
240
|
require_relative "cadenya/models/objective_secret"
|
|
234
241
|
require_relative "cadenya/models/operation_metadata"
|
|
@@ -14,11 +14,6 @@ module Cadenya
|
|
|
14
14
|
)
|
|
15
15
|
end
|
|
16
16
|
|
|
17
|
-
# The initial message passed to CreateObjective on each fire. Becomes the first
|
|
18
|
-
# user message in the objective's chat history.
|
|
19
|
-
sig { returns(String) }
|
|
20
|
-
attr_accessor :initial_message
|
|
21
|
-
|
|
22
17
|
# Schedule defines WHEN the schedule fires. Temporal-style structured form: a list
|
|
23
18
|
# of calendar rules (wall-clock) and/or interval rules (duration), OR'd together.
|
|
24
19
|
# At least one rule is required.
|
|
@@ -40,6 +35,15 @@ module Cadenya
|
|
|
40
35
|
sig { params(data: T.anything).void }
|
|
41
36
|
attr_writer :data
|
|
42
37
|
|
|
38
|
+
# Optional initial message passed to CreateObjective on each fire. Becomes the
|
|
39
|
+
# first user message in the objective's chat history. When unset, the fired
|
|
40
|
+
# objective defers to the selected variation's user_message_template.
|
|
41
|
+
sig { returns(T.nilable(String)) }
|
|
42
|
+
attr_reader :initial_message
|
|
43
|
+
|
|
44
|
+
sig { params(initial_message: String).void }
|
|
45
|
+
attr_writer :initial_message
|
|
46
|
+
|
|
43
47
|
# What to do when the previous run is still in flight. Defaults to SKIP.
|
|
44
48
|
sig do
|
|
45
49
|
returns(
|
|
@@ -58,6 +62,15 @@ module Cadenya
|
|
|
58
62
|
end
|
|
59
63
|
attr_writer :overlap_policy
|
|
60
64
|
|
|
65
|
+
# Optional data rendered into the variation's user_message_template when each
|
|
66
|
+
# fired objective is created. Separate from `data`, which renders the system
|
|
67
|
+
# prompt template.
|
|
68
|
+
sig { returns(T.nilable(T.anything)) }
|
|
69
|
+
attr_reader :user_data
|
|
70
|
+
|
|
71
|
+
sig { params(user_data: T.anything).void }
|
|
72
|
+
attr_writer :user_data
|
|
73
|
+
|
|
61
74
|
# Optional explicit variation. When unset, the agent's variation_selection_mode
|
|
62
75
|
# chooses per fire.
|
|
63
76
|
sig { returns(T.nilable(String)) }
|
|
@@ -69,18 +82,16 @@ module Cadenya
|
|
|
69
82
|
# AgentScheduleSpec is the user-provided configuration for a schedule.
|
|
70
83
|
sig do
|
|
71
84
|
params(
|
|
72
|
-
initial_message: String,
|
|
73
85
|
schedule: Cadenya::Agents::AgentScheduleSpecSchedule::OrHash,
|
|
74
86
|
data: T.anything,
|
|
87
|
+
initial_message: String,
|
|
75
88
|
overlap_policy:
|
|
76
89
|
Cadenya::Agents::AgentScheduleSpec::OverlapPolicy::OrSymbol,
|
|
90
|
+
user_data: T.anything,
|
|
77
91
|
variation_id: String
|
|
78
92
|
).returns(T.attached_class)
|
|
79
93
|
end
|
|
80
94
|
def self.new(
|
|
81
|
-
# The initial message passed to CreateObjective on each fire. Becomes the first
|
|
82
|
-
# user message in the objective's chat history.
|
|
83
|
-
initial_message:,
|
|
84
95
|
# Schedule defines WHEN the schedule fires. Temporal-style structured form: a list
|
|
85
96
|
# of calendar rules (wall-clock) and/or interval rules (duration), OR'd together.
|
|
86
97
|
# At least one rule is required.
|
|
@@ -88,8 +99,16 @@ module Cadenya
|
|
|
88
99
|
# Optional input data passed to the objective. If the agent has an
|
|
89
100
|
# input_data_schema, this must satisfy it.
|
|
90
101
|
data: nil,
|
|
102
|
+
# Optional initial message passed to CreateObjective on each fire. Becomes the
|
|
103
|
+
# first user message in the objective's chat history. When unset, the fired
|
|
104
|
+
# objective defers to the selected variation's user_message_template.
|
|
105
|
+
initial_message: nil,
|
|
91
106
|
# What to do when the previous run is still in flight. Defaults to SKIP.
|
|
92
107
|
overlap_policy: nil,
|
|
108
|
+
# Optional data rendered into the variation's user_message_template when each
|
|
109
|
+
# fired objective is created. Separate from `data`, which renders the system
|
|
110
|
+
# prompt template.
|
|
111
|
+
user_data: nil,
|
|
93
112
|
# Optional explicit variation. When unset, the agent's variation_selection_mode
|
|
94
113
|
# chooses per fire.
|
|
95
114
|
variation_id: nil
|
|
@@ -99,11 +118,12 @@ module Cadenya
|
|
|
99
118
|
sig do
|
|
100
119
|
override.returns(
|
|
101
120
|
{
|
|
102
|
-
initial_message: String,
|
|
103
121
|
schedule: Cadenya::Agents::AgentScheduleSpecSchedule,
|
|
104
122
|
data: T.anything,
|
|
123
|
+
initial_message: String,
|
|
105
124
|
overlap_policy:
|
|
106
125
|
Cadenya::Agents::AgentScheduleSpec::OverlapPolicy::OrSymbol,
|
|
126
|
+
user_data: T.anything,
|
|
107
127
|
variation_id: String
|
|
108
128
|
}
|
|
109
129
|
)
|
|
@@ -103,12 +103,24 @@ module Cadenya
|
|
|
103
103
|
end
|
|
104
104
|
attr_writer :progressive_discovery
|
|
105
105
|
|
|
106
|
-
#
|
|
106
|
+
# Liquid template for the system prompt of objectives using this variation.
|
|
107
|
+
# Rendered with CreateObjectiveRequest.data into Objective.system_prompt.
|
|
107
108
|
sig { returns(T.nilable(String)) }
|
|
108
|
-
attr_reader :
|
|
109
|
+
attr_reader :system_prompt_template
|
|
109
110
|
|
|
110
|
-
sig { params(
|
|
111
|
-
attr_writer :
|
|
111
|
+
sig { params(system_prompt_template: String).void }
|
|
112
|
+
attr_writer :system_prompt_template
|
|
113
|
+
|
|
114
|
+
# Liquid template for the initial user message of objectives using this variation.
|
|
115
|
+
# Rendered with CreateObjectiveRequest.user_data and becomes the first user
|
|
116
|
+
# message in the LLM chat history. CreateObjectiveRequest.initial_message, when
|
|
117
|
+
# set, overrides the rendered result. If neither this template nor initial_message
|
|
118
|
+
# is present, objective creation is rejected with InvalidArgument.
|
|
119
|
+
sig { returns(T.nilable(String)) }
|
|
120
|
+
attr_reader :user_message_template
|
|
121
|
+
|
|
122
|
+
sig { params(user_message_template: String).void }
|
|
123
|
+
attr_writer :user_message_template
|
|
112
124
|
|
|
113
125
|
# Weight for weighted random selection (>= 0). P(v) = v.weight / sum(all_weights).
|
|
114
126
|
# Only used when the agent's variation_selection_mode is WEIGHTED. A weight of 0
|
|
@@ -133,7 +145,8 @@ module Cadenya
|
|
|
133
145
|
Cadenya::Agents::AgentVariationSpecModelConfig::OrHash,
|
|
134
146
|
progressive_discovery:
|
|
135
147
|
Cadenya::Agents::AgentVariationSpecProgressiveDiscovery::OrHash,
|
|
136
|
-
|
|
148
|
+
system_prompt_template: String,
|
|
149
|
+
user_message_template: String,
|
|
137
150
|
weight: Integer
|
|
138
151
|
).returns(T.attached_class)
|
|
139
152
|
end
|
|
@@ -162,8 +175,15 @@ module Cadenya
|
|
|
162
175
|
# tool search. These are used in conjunction with the context-aware tool search
|
|
163
176
|
# and can help select the best tools for the task.
|
|
164
177
|
progressive_discovery: nil,
|
|
165
|
-
#
|
|
166
|
-
|
|
178
|
+
# Liquid template for the system prompt of objectives using this variation.
|
|
179
|
+
# Rendered with CreateObjectiveRequest.data into Objective.system_prompt.
|
|
180
|
+
system_prompt_template: nil,
|
|
181
|
+
# Liquid template for the initial user message of objectives using this variation.
|
|
182
|
+
# Rendered with CreateObjectiveRequest.user_data and becomes the first user
|
|
183
|
+
# message in the LLM chat history. CreateObjectiveRequest.initial_message, when
|
|
184
|
+
# set, overrides the rendered result. If neither this template nor initial_message
|
|
185
|
+
# is present, objective creation is rejected with InvalidArgument.
|
|
186
|
+
user_message_template: nil,
|
|
167
187
|
# Weight for weighted random selection (>= 0). P(v) = v.weight / sum(all_weights).
|
|
168
188
|
# Only used when the agent's variation_selection_mode is WEIGHTED. A weight of 0
|
|
169
189
|
# means never auto-selected, but can still be chosen explicitly via variation_id
|
|
@@ -184,7 +204,8 @@ module Cadenya
|
|
|
184
204
|
model_config: Cadenya::Agents::AgentVariationSpecModelConfig,
|
|
185
205
|
progressive_discovery:
|
|
186
206
|
Cadenya::Agents::AgentVariationSpecProgressiveDiscovery,
|
|
187
|
-
|
|
207
|
+
system_prompt_template: String,
|
|
208
|
+
user_message_template: String,
|
|
188
209
|
weight: Integer
|
|
189
210
|
}
|
|
190
211
|
)
|
|
@@ -107,6 +107,13 @@ module Cadenya
|
|
|
107
107
|
sig { params(state_message: String).void }
|
|
108
108
|
attr_writer :state_message
|
|
109
109
|
|
|
110
|
+
# Arbitrary data used to render the variation's user_message_template
|
|
111
|
+
sig { returns(T.nilable(T::Hash[Symbol, T.anything])) }
|
|
112
|
+
attr_reader :user_data
|
|
113
|
+
|
|
114
|
+
sig { params(user_data: T::Hash[Symbol, T.anything]).void }
|
|
115
|
+
attr_writer :user_data
|
|
116
|
+
|
|
110
117
|
# Objective is the data for an objective. It contains the snapshotted fields for
|
|
111
118
|
# the selected agent and variation. Secrets are returned only with their names,
|
|
112
119
|
# and the output definition is copied from the agent's configuration.
|
|
@@ -123,7 +130,8 @@ module Cadenya
|
|
|
123
130
|
output: T::Hash[Symbol, T.anything],
|
|
124
131
|
parent_objective_id: String,
|
|
125
132
|
secrets: T::Array[Cadenya::ObjectiveSecret::OrHash],
|
|
126
|
-
state_message: String
|
|
133
|
+
state_message: String,
|
|
134
|
+
user_data: T::Hash[Symbol, T.anything]
|
|
127
135
|
).returns(T.attached_class)
|
|
128
136
|
end
|
|
129
137
|
def self.new(
|
|
@@ -172,7 +180,9 @@ module Cadenya
|
|
|
172
180
|
# interpolation format.
|
|
173
181
|
secrets: nil,
|
|
174
182
|
# Optional human-readable detail about the current state (e.g. a failure reason).
|
|
175
|
-
state_message: nil
|
|
183
|
+
state_message: nil,
|
|
184
|
+
# Arbitrary data used to render the variation's user_message_template
|
|
185
|
+
user_data: nil
|
|
176
186
|
)
|
|
177
187
|
end
|
|
178
188
|
|
|
@@ -190,7 +200,8 @@ module Cadenya
|
|
|
190
200
|
output: T::Hash[Symbol, T.anything],
|
|
191
201
|
parent_objective_id: String,
|
|
192
202
|
secrets: T::Array[Cadenya::ObjectiveSecret],
|
|
193
|
-
state_message: String
|
|
203
|
+
state_message: String,
|
|
204
|
+
user_data: T::Hash[Symbol, T.anything]
|
|
194
205
|
}
|
|
195
206
|
)
|
|
196
207
|
end
|
|
@@ -22,9 +22,11 @@ module Cadenya
|
|
|
22
22
|
sig { returns(T::Hash[Symbol, T.anything]) }
|
|
23
23
|
attr_accessor :data
|
|
24
24
|
|
|
25
|
-
# Optional override for initial message sent to the agent. This becomes the
|
|
26
|
-
# user message in the LLM chat history.
|
|
27
|
-
#
|
|
25
|
+
# Optional override for the initial message sent to the agent. This becomes the
|
|
26
|
+
# first user message in the LLM chat history. When not set, the selected
|
|
27
|
+
# variation's user_message_template is rendered with user_data instead. If neither
|
|
28
|
+
# this field nor a user_message_template is present, the request is rejected with
|
|
29
|
+
# InvalidArgument.
|
|
28
30
|
sig { returns(T.nilable(String)) }
|
|
29
31
|
attr_reader :initial_message
|
|
30
32
|
|
|
@@ -77,6 +79,15 @@ module Cadenya
|
|
|
77
79
|
end
|
|
78
80
|
attr_writer :secrets
|
|
79
81
|
|
|
82
|
+
# Arbitrary data rendered into the selected variation's user_message_template
|
|
83
|
+
# (liquid) to produce the initial user message. Separate from `data`, which
|
|
84
|
+
# renders the system prompt template.
|
|
85
|
+
sig { returns(T.nilable(T::Hash[Symbol, T.anything])) }
|
|
86
|
+
attr_reader :user_data
|
|
87
|
+
|
|
88
|
+
sig { params(user_data: T::Hash[Symbol, T.anything]).void }
|
|
89
|
+
attr_writer :user_data
|
|
90
|
+
|
|
80
91
|
# Optional explicit variation selection. Overrides the agent's
|
|
81
92
|
# variation_selection_mode.
|
|
82
93
|
sig { returns(T.nilable(String)) }
|
|
@@ -94,6 +105,7 @@ module Cadenya
|
|
|
94
105
|
memory_stack: T::Array[Cadenya::MemoryReference::OrHash],
|
|
95
106
|
metadata: Cadenya::CreateOperationMetadata::OrHash,
|
|
96
107
|
secrets: T::Array[Cadenya::ObjectiveCreateParams::Secret::OrHash],
|
|
108
|
+
user_data: T::Hash[Symbol, T.anything],
|
|
97
109
|
variation_id: String,
|
|
98
110
|
request_options: Cadenya::RequestOptions::OrHash
|
|
99
111
|
).returns(T.attached_class)
|
|
@@ -104,9 +116,11 @@ module Cadenya
|
|
|
104
116
|
# Arbitrary data for the objective. May be used in liquid templates for prompts
|
|
105
117
|
# configured on the agent variation
|
|
106
118
|
data:,
|
|
107
|
-
# Optional override for initial message sent to the agent. This becomes the
|
|
108
|
-
# user message in the LLM chat history.
|
|
109
|
-
#
|
|
119
|
+
# Optional override for the initial message sent to the agent. This becomes the
|
|
120
|
+
# first user message in the LLM chat history. When not set, the selected
|
|
121
|
+
# variation's user_message_template is rendered with user_data instead. If neither
|
|
122
|
+
# this field nor a user_message_template is present, the request is rejected with
|
|
123
|
+
# InvalidArgument.
|
|
110
124
|
initial_message: nil,
|
|
111
125
|
# Memory layers/entries to push onto this objective's memory stack on top of the
|
|
112
126
|
# baseline stack inherited from the selected variation.
|
|
@@ -131,6 +145,10 @@ module Cadenya
|
|
|
131
145
|
# Secrets that can be used in the headers for tool calls using the secret
|
|
132
146
|
# interpolation format.
|
|
133
147
|
secrets: nil,
|
|
148
|
+
# Arbitrary data rendered into the selected variation's user_message_template
|
|
149
|
+
# (liquid) to produce the initial user message. Separate from `data`, which
|
|
150
|
+
# renders the system prompt template.
|
|
151
|
+
user_data: nil,
|
|
134
152
|
# Optional explicit variation selection. Overrides the agent's
|
|
135
153
|
# variation_selection_mode.
|
|
136
154
|
variation_id: nil,
|
|
@@ -148,6 +166,7 @@ module Cadenya
|
|
|
148
166
|
memory_stack: T::Array[Cadenya::MemoryReference],
|
|
149
167
|
metadata: Cadenya::CreateOperationMetadata,
|
|
150
168
|
secrets: T::Array[Cadenya::ObjectiveCreateParams::Secret],
|
|
169
|
+
user_data: T::Hash[Symbol, T.anything],
|
|
151
170
|
variation_id: String,
|
|
152
171
|
request_options: Cadenya::RequestOptions
|
|
153
172
|
}
|
|
@@ -38,13 +38,6 @@ module Cadenya
|
|
|
38
38
|
sig { params(memo: String).void }
|
|
39
39
|
attr_writer :memo
|
|
40
40
|
|
|
41
|
-
# The result content returned by the tool after execution
|
|
42
|
-
sig { returns(T.nilable(String)) }
|
|
43
|
-
attr_reader :result
|
|
44
|
-
|
|
45
|
-
sig { params(result: String).void }
|
|
46
|
-
attr_writer :result
|
|
47
|
-
|
|
48
41
|
# A profile identifies a user or non-human principal (such as an API key) at the
|
|
49
42
|
# account level. Profiles are account-scoped and can be granted access to multiple
|
|
50
43
|
# workspaces.
|
|
@@ -59,7 +52,6 @@ module Cadenya
|
|
|
59
52
|
callable: Cadenya::CallableTool::OrHash,
|
|
60
53
|
arguments: T::Hash[Symbol, T.anything],
|
|
61
54
|
memo: String,
|
|
62
|
-
result: String,
|
|
63
55
|
status_changed_by: Cadenya::Profile::OrHash
|
|
64
56
|
).returns(T.attached_class)
|
|
65
57
|
end
|
|
@@ -73,8 +65,6 @@ module Cadenya
|
|
|
73
65
|
arguments: nil,
|
|
74
66
|
# A memo supplied by the reviewer when denying the tool call
|
|
75
67
|
memo: nil,
|
|
76
|
-
# The result content returned by the tool after execution
|
|
77
|
-
result: nil,
|
|
78
68
|
# A profile identifies a user or non-human principal (such as an API key) at the
|
|
79
69
|
# account level. Profiles are account-scoped and can be granted access to multiple
|
|
80
70
|
# workspaces.
|
|
@@ -88,7 +78,6 @@ module Cadenya
|
|
|
88
78
|
callable: Cadenya::CallableTool,
|
|
89
79
|
arguments: T::Hash[Symbol, T.anything],
|
|
90
80
|
memo: String,
|
|
91
|
-
result: String,
|
|
92
81
|
status_changed_by: Cadenya::Profile
|
|
93
82
|
}
|
|
94
83
|
)
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# typed: strong
|
|
2
|
+
|
|
3
|
+
module Cadenya
|
|
4
|
+
module Models
|
|
5
|
+
ObjectiveToolCallResult = Objectives::ObjectiveToolCallResult
|
|
6
|
+
|
|
7
|
+
module Objectives
|
|
8
|
+
class ObjectiveToolCallResult < Cadenya::Internal::Type::BaseModel
|
|
9
|
+
OrHash =
|
|
10
|
+
T.type_alias do
|
|
11
|
+
T.any(
|
|
12
|
+
Cadenya::Objectives::ObjectiveToolCallResult,
|
|
13
|
+
Cadenya::Internal::AnyHash
|
|
14
|
+
)
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
sig do
|
|
18
|
+
returns(
|
|
19
|
+
T::Array[Cadenya::Objectives::ObjectiveToolCallResultContentBlock]
|
|
20
|
+
)
|
|
21
|
+
end
|
|
22
|
+
attr_accessor :content
|
|
23
|
+
|
|
24
|
+
# ObjectiveToolCallResult is the content a tool returned after execution. Tools
|
|
25
|
+
# can return multiple content blocks, and blocks can be multi-modal (text, image,
|
|
26
|
+
# audio). Media blocks are stored by Cadenya and served as short-lived signed URLs
|
|
27
|
+
# rather than inline bytes.
|
|
28
|
+
sig do
|
|
29
|
+
params(
|
|
30
|
+
content:
|
|
31
|
+
T::Array[
|
|
32
|
+
Cadenya::Objectives::ObjectiveToolCallResultContentBlock::OrHash
|
|
33
|
+
]
|
|
34
|
+
).returns(T.attached_class)
|
|
35
|
+
end
|
|
36
|
+
def self.new(content:)
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
sig do
|
|
40
|
+
override.returns(
|
|
41
|
+
{
|
|
42
|
+
content:
|
|
43
|
+
T::Array[
|
|
44
|
+
Cadenya::Objectives::ObjectiveToolCallResultContentBlock
|
|
45
|
+
]
|
|
46
|
+
}
|
|
47
|
+
)
|
|
48
|
+
end
|
|
49
|
+
def to_hash
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
end
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
# typed: strong
|
|
2
|
+
|
|
3
|
+
module Cadenya
|
|
4
|
+
module Models
|
|
5
|
+
ObjectiveToolCallResultAudioBlock =
|
|
6
|
+
Objectives::ObjectiveToolCallResultAudioBlock
|
|
7
|
+
|
|
8
|
+
module Objectives
|
|
9
|
+
class ObjectiveToolCallResultAudioBlock < Cadenya::Internal::Type::BaseModel
|
|
10
|
+
OrHash =
|
|
11
|
+
T.type_alias do
|
|
12
|
+
T.any(
|
|
13
|
+
Cadenya::Objectives::ObjectiveToolCallResultAudioBlock,
|
|
14
|
+
Cadenya::Internal::AnyHash
|
|
15
|
+
)
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
# When the signed URL expires.
|
|
19
|
+
sig { returns(Time) }
|
|
20
|
+
attr_accessor :expires_at
|
|
21
|
+
|
|
22
|
+
# IANA media type of the stored audio, e.g. audio/wav.
|
|
23
|
+
sig { returns(String) }
|
|
24
|
+
attr_accessor :mime_type
|
|
25
|
+
|
|
26
|
+
# Size of the stored audio in bytes.
|
|
27
|
+
sig { returns(String) }
|
|
28
|
+
attr_accessor :size_bytes
|
|
29
|
+
|
|
30
|
+
# Short-lived signed URL to download the stored audio.
|
|
31
|
+
sig { returns(String) }
|
|
32
|
+
attr_accessor :url
|
|
33
|
+
|
|
34
|
+
sig do
|
|
35
|
+
params(
|
|
36
|
+
expires_at: Time,
|
|
37
|
+
mime_type: String,
|
|
38
|
+
size_bytes: String,
|
|
39
|
+
url: String
|
|
40
|
+
).returns(T.attached_class)
|
|
41
|
+
end
|
|
42
|
+
def self.new(
|
|
43
|
+
# When the signed URL expires.
|
|
44
|
+
expires_at:,
|
|
45
|
+
# IANA media type of the stored audio, e.g. audio/wav.
|
|
46
|
+
mime_type:,
|
|
47
|
+
# Size of the stored audio in bytes.
|
|
48
|
+
size_bytes:,
|
|
49
|
+
# Short-lived signed URL to download the stored audio.
|
|
50
|
+
url:
|
|
51
|
+
)
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
sig do
|
|
55
|
+
override.returns(
|
|
56
|
+
{
|
|
57
|
+
expires_at: Time,
|
|
58
|
+
mime_type: String,
|
|
59
|
+
size_bytes: String,
|
|
60
|
+
url: String
|
|
61
|
+
}
|
|
62
|
+
)
|
|
63
|
+
end
|
|
64
|
+
def to_hash
|
|
65
|
+
end
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
|
+
end
|
|
69
|
+
end
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
# typed: strong
|
|
2
|
+
|
|
3
|
+
module Cadenya
|
|
4
|
+
module Models
|
|
5
|
+
ObjectiveToolCallResultContentBlock =
|
|
6
|
+
Objectives::ObjectiveToolCallResultContentBlock
|
|
7
|
+
|
|
8
|
+
module Objectives
|
|
9
|
+
class ObjectiveToolCallResultContentBlock < Cadenya::Internal::Type::BaseModel
|
|
10
|
+
OrHash =
|
|
11
|
+
T.type_alias do
|
|
12
|
+
T.any(
|
|
13
|
+
Cadenya::Objectives::ObjectiveToolCallResultContentBlock,
|
|
14
|
+
Cadenya::Internal::AnyHash
|
|
15
|
+
)
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
sig do
|
|
19
|
+
returns(
|
|
20
|
+
T.nilable(Cadenya::Objectives::ObjectiveToolCallResultAudioBlock)
|
|
21
|
+
)
|
|
22
|
+
end
|
|
23
|
+
attr_reader :audio
|
|
24
|
+
|
|
25
|
+
sig do
|
|
26
|
+
params(
|
|
27
|
+
audio:
|
|
28
|
+
Cadenya::Objectives::ObjectiveToolCallResultAudioBlock::OrHash
|
|
29
|
+
).void
|
|
30
|
+
end
|
|
31
|
+
attr_writer :audio
|
|
32
|
+
|
|
33
|
+
sig do
|
|
34
|
+
returns(
|
|
35
|
+
T.nilable(Cadenya::Objectives::ObjectiveToolCallResultImageBlock)
|
|
36
|
+
)
|
|
37
|
+
end
|
|
38
|
+
attr_reader :image
|
|
39
|
+
|
|
40
|
+
sig do
|
|
41
|
+
params(
|
|
42
|
+
image:
|
|
43
|
+
Cadenya::Objectives::ObjectiveToolCallResultImageBlock::OrHash
|
|
44
|
+
).void
|
|
45
|
+
end
|
|
46
|
+
attr_writer :image
|
|
47
|
+
|
|
48
|
+
sig do
|
|
49
|
+
returns(
|
|
50
|
+
T.nilable(Cadenya::Objectives::ObjectiveToolCallResultTextBlock)
|
|
51
|
+
)
|
|
52
|
+
end
|
|
53
|
+
attr_reader :text
|
|
54
|
+
|
|
55
|
+
sig do
|
|
56
|
+
params(
|
|
57
|
+
text: Cadenya::Objectives::ObjectiveToolCallResultTextBlock::OrHash
|
|
58
|
+
).void
|
|
59
|
+
end
|
|
60
|
+
attr_writer :text
|
|
61
|
+
|
|
62
|
+
# ContentBlock is a single block of tool result content. Exactly one of the
|
|
63
|
+
# variants is set.
|
|
64
|
+
sig do
|
|
65
|
+
params(
|
|
66
|
+
audio:
|
|
67
|
+
Cadenya::Objectives::ObjectiveToolCallResultAudioBlock::OrHash,
|
|
68
|
+
image:
|
|
69
|
+
Cadenya::Objectives::ObjectiveToolCallResultImageBlock::OrHash,
|
|
70
|
+
text: Cadenya::Objectives::ObjectiveToolCallResultTextBlock::OrHash
|
|
71
|
+
).returns(T.attached_class)
|
|
72
|
+
end
|
|
73
|
+
def self.new(audio: nil, image: nil, text: nil)
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
sig do
|
|
77
|
+
override.returns(
|
|
78
|
+
{
|
|
79
|
+
audio: Cadenya::Objectives::ObjectiveToolCallResultAudioBlock,
|
|
80
|
+
image: Cadenya::Objectives::ObjectiveToolCallResultImageBlock,
|
|
81
|
+
text: Cadenya::Objectives::ObjectiveToolCallResultTextBlock
|
|
82
|
+
}
|
|
83
|
+
)
|
|
84
|
+
end
|
|
85
|
+
def to_hash
|
|
86
|
+
end
|
|
87
|
+
end
|
|
88
|
+
end
|
|
89
|
+
end
|
|
90
|
+
end
|