cadenya 1.0.1 → 1.2.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 848ebb2b39aa33946683d9bb929d35b07eb615cc8babce18f4f3ca3ae46440b7
4
- data.tar.gz: 753a08e80d462781aed796a2a96ac29801d68b7136d29fdd1ddffdd57853eb39
3
+ metadata.gz: 013b58ef0934a5ca4ea7040a002c80dbfeaf0f3b02f138f5d6925e6961a51295
4
+ data.tar.gz: a7c8de763e5b93f1def5de75836d3866ff5549d20493f34682efb62ef75358e7
5
5
  SHA512:
6
- metadata.gz: 428b7b7b043d6b41b920b1146c502bbd453fb8c340a2feb46a50d12162baa0ce57c0ef45cd5fdf0def9d494cfa81d10deef488397dab6dbd8fd0e4b5b45afecc
7
- data.tar.gz: 198b736f259553305b7f5b90df3caf15c2e798152e4c8d92dbefcfa601d624d21e4b0984e724d1dd9a736195fcc86fe23c94dcc15f37d398c7d87bcd026b17a6
6
+ metadata.gz: 841ee4ca3c6a6894bb9d1eaa56c97da4d27f162a35b7e35006493fed23ba7106fb1dc7188a5b30b9d24c0cf4e1d5633096d3da4ca3f2f1677e31d27dab57ee04
7
+ data.tar.gz: 9c44b073058d366d5176e58bc810ce0c0444a42cd2e64d6d67793cea5ab35e532ec43d6776624107b18eea7acad159b6a1be5fce6cd73b9359f7cc7b9df2fa91
data/api.md CHANGED
@@ -278,27 +278,27 @@ client.agents.variations.update(agent_id, id, workspace_id: nil, metadata: nil,
278
278
  Add an assignment to a variation
279
279
 
280
280
  ```ruby
281
- client.agents.variations.add_assignment(agent_id, variation_id, body:, workspace_id: nil) # => Cadenya::Types::VariationAssignment
281
+ client.agents.variations.add_assignment(agent_id, variation_id, body:, workspace_id: nil) # => Cadenya::Types::AgentVariation
282
282
  ```
283
- Remove an assignment from a variation
283
+ Attach a memory layer to a variation
284
284
 
285
285
  ```ruby
286
- client.agents.variations.remove_assignment(agent_id, variation_id, id, workspace_id: nil) # => nil
286
+ client.agents.variations.add_memory_layer(agent_id, variation_id, memory_layer_id:, workspace_id: nil, position: nil) # => Cadenya::Types::AgentVariation
287
287
  ```
288
- Attach a memory layer to a variation
288
+ Remove an assignment from a variation
289
289
 
290
290
  ```ruby
291
- client.agents.variations.add_memory_layer(agent_id, variation_id, memory_layer_id:, workspace_id: nil, position: nil) # => Cadenya::Types::VariationMemoryLayerAssignment
291
+ client.agents.variations.remove_assignment(agent_id, variation_id, body:, workspace_id: nil) # => Cadenya::Types::AgentVariation
292
292
  ```
293
293
  Remove a memory layer assignment from a variation
294
294
 
295
295
  ```ruby
296
- client.agents.variations.remove_memory_layer(agent_id, variation_id, id, workspace_id: nil) # => nil
296
+ client.agents.variations.remove_memory_layer(agent_id, variation_id, memory_layer_id:, workspace_id: nil) # => Cadenya::Types::AgentVariation
297
297
  ```
298
298
  Update a variation's memory layer assignment
299
299
 
300
300
  ```ruby
301
- client.agents.variations.update_memory_layer(agent_id, variation_id, id, workspace_id: nil, position: nil) # => Cadenya::Types::VariationMemoryLayerAssignment
301
+ client.agents.variations.update_memory_layer(agent_id, variation_id, memory_layer_id:, position:, workspace_id: nil) # => Cadenya::Types::AgentVariation
302
302
  ```
303
303
 
304
304
  ## client.ai_provider_keys
@@ -316,7 +316,7 @@ client.ai_provider_keys.create(metadata:, spec:, workspace_id: nil) # => Cadenya
316
316
  Get an AI provider key by ID
317
317
 
318
318
  ```ruby
319
- client.ai_provider_keys.retrieve(id, workspace_id: nil) # => Cadenya::Types::AIProviderKey
319
+ client.ai_provider_keys.retrieve(id, workspace_id: nil, include_info: nil) # => Cadenya::Types::AIProviderKey
320
320
  ```
321
321
  Delete an AI provider key
322
322
 
@@ -326,7 +326,45 @@ client.ai_provider_keys.delete(id, workspace_id: nil) # => nil
326
326
  Update an AI provider key
327
327
 
328
328
  ```ruby
329
- client.ai_provider_keys.update(id, workspace_id: nil, metadata: nil, spec: nil, update_mask: nil) # => Cadenya::Types::AIProviderKey
329
+ client.ai_provider_keys.update(id, workspace_id: nil, metadata: nil, spec: nil, update_mask: nil, credential_patch: nil) # => Cadenya::Types::AIProviderKey
330
+ ```
331
+
332
+ ## client.models
333
+
334
+ Create a model
335
+
336
+ ```ruby
337
+ client.models.create(ai_provider_key_id, metadata:, spec:, workspace_id: nil) # => Cadenya::Types::Model
338
+ ```
339
+ List models
340
+
341
+ ```ruby
342
+ client.models.list(workspace_id: nil, limit: nil, cursor: nil, prefix: nil, query: nil, state: nil, ai_provider_key_id: nil, is_assigned: nil, labels: nil, sort_order: nil, include_info: nil) # => Cadenya::Page of Cadenya::Types::Model
343
+ ```
344
+ Get a model by ID
345
+
346
+ ```ruby
347
+ client.models.retrieve(id, workspace_id: nil) # => Cadenya::Types::Model
348
+ ```
349
+ Update a model
350
+
351
+ ```ruby
352
+ client.models.update(id, workspace_id: nil, metadata: nil, spec: nil, pricing_override: nil, update_mask: nil) # => Cadenya::Types::Model
353
+ ```
354
+ Disable a model
355
+
356
+ ```ruby
357
+ client.models.disable(id, workspace_id: nil) # => Cadenya::Types::Model
358
+ ```
359
+ Enable a model
360
+
361
+ ```ruby
362
+ client.models.enable(id, workspace_id: nil) # => Cadenya::Types::Model
363
+ ```
364
+ Swap models on agent variations
365
+
366
+ ```ruby
367
+ client.models.swap_on_variations(workspace_id: nil, model_swaps: nil) # => nil
330
368
  ```
331
369
 
332
370
  ## client.memory_layers
@@ -385,34 +423,6 @@ Update a memory entry
385
423
  client.memory_layers.entries.update(memory_layer_id, id, workspace_id: nil, metadata: nil, spec: nil, update_mask: nil) # => Cadenya::Types::MemoryEntryDetail
386
424
  ```
387
425
 
388
- ## client.models
389
-
390
- List models
391
-
392
- ```ruby
393
- client.models.list(workspace_id: nil, limit: nil, cursor: nil, prefix: nil, query: nil, state: nil, ai_provider_key_id: nil, is_assigned: nil, labels: nil, sort_order: nil, include_info: nil) # => Cadenya::Page of Cadenya::Types::Model
394
- ```
395
- Get a model by ID
396
-
397
- ```ruby
398
- client.models.retrieve(id, workspace_id: nil) # => Cadenya::Types::Model
399
- ```
400
- Disable a model
401
-
402
- ```ruby
403
- client.models.disable(id, workspace_id: nil) # => Cadenya::Types::Model
404
- ```
405
- Enable a model
406
-
407
- ```ruby
408
- client.models.enable(id, workspace_id: nil) # => Cadenya::Types::Model
409
- ```
410
- Swap models on agent variations
411
-
412
- ```ruby
413
- client.models.swap_on_variations(workspace_id: nil, model_swaps: nil) # => nil
414
- ```
415
-
416
426
  ## client.objectives
417
427
 
418
428
  List objectives
@@ -460,16 +470,6 @@ Submit feedback for an objective
460
470
  ```ruby
461
471
  client.objectives.create_feedback(objective_id, metadata:, data:, workspace_id: nil) # => Cadenya::Types::ObjectiveFeedback
462
472
  ```
463
- List objective tasks
464
-
465
- ```ruby
466
- client.objectives.list_tasks(objective_id, workspace_id: nil, limit: nil, cursor: nil, sort_order: nil) # => Cadenya::Page of Cadenya::Types::ObjectiveTask
467
- ```
468
- Get an objective task by ID
469
-
470
- ```ruby
471
- client.objectives.retrieve_task(objective_id, id, workspace_id: nil) # => Cadenya::Types::ObjectiveTask
472
- ```
473
473
  List objective tool calls
474
474
 
475
475
  ```ruby
@@ -8,7 +8,7 @@ module Cadenya
8
8
  # The Cadenya API client. Resource groups are readers; unset options are
9
9
  # read from the environment.
10
10
  class Client
11
- attr_reader :accounts, :api_keys, :workspace_admin, :profiles, :workspaces, :agents, :ai_provider_keys, :memory_layers, :models, :objectives, :tool_search, :tenants, :tool_sets, :uploads, :widget_sessions, :widgets, :workspace_secrets
11
+ attr_reader :accounts, :api_keys, :workspace_admin, :profiles, :workspaces, :agents, :ai_provider_keys, :models, :memory_layers, :objectives, :tool_search, :tenants, :tool_sets, :uploads, :widget_sessions, :widgets, :workspace_secrets
12
12
 
13
13
  def initialize(api_key: nil, base_url: nil, webhook_secret: nil, max_retries: 0, connection: nil, stream_transport: nil, workspace_id: nil)
14
14
  if !api_key.nil? && api_key.to_s.strip.empty?
@@ -37,7 +37,7 @@ module Cadenya
37
37
  auth_header: ["Authorization", "Bearer #{api_key}"],
38
38
  max_retries: max_retries,
39
39
  defaults: defaults,
40
- user_agent: "cadenya-ruby/1.0.0 (api 1.0)",
40
+ user_agent: "cadenya-ruby/1.2.0 (api 1.0)",
41
41
  connection: connection,
42
42
  stream_transport: stream_transport
43
43
  )
@@ -48,8 +48,8 @@ module Cadenya
48
48
  @workspaces = Resources::Workspaces.new(core)
49
49
  @agents = Resources::Agents.new(core)
50
50
  @ai_provider_keys = Resources::AiProviderKeys.new(core)
51
- @memory_layers = Resources::MemoryLayers.new(core)
52
51
  @models = Resources::Models.new(core)
52
+ @memory_layers = Resources::MemoryLayers.new(core)
53
53
  @objectives = Resources::Objectives.new(core)
54
54
  @tool_search = Resources::ToolSearch.new(core)
55
55
  @tenants = Resources::Tenants.new(core)
@@ -72,48 +72,52 @@ module Cadenya
72
72
  # Add an assignment to a variation
73
73
  def add_assignment(agent_id, variation_id, body:, workspace_id: nil, request_options: nil)
74
74
  workspace_id = @core.resolve_default("workspaceId", "CADENYA_WORKSPACE_ID", workspace_id)
75
- _path = "/v1/workspaces/#{Util.path_param('workspaceId', workspace_id)}/agents/#{Util.path_param('agentId', agent_id)}/variations/#{Util.path_param('variationId', variation_id)}/assignments"
75
+ _path = "/v1/workspaces/#{Util.path_param('workspaceId', workspace_id)}/agents/#{Util.path_param('agentId', agent_id)}/variations/#{Util.path_param('variationId', variation_id)}:addAssignment"
76
76
  _data = @core.request(:post, _path, body: (->(_v) { Types.encode_AddAgentVariationAssignmentRequest(_v) }).call(body), request_options: request_options)
77
- Types.decode_VariationAssignment(_data)
78
- end
79
-
80
- # Remove an assignment from a variation
81
- def remove_assignment(agent_id, variation_id, id, workspace_id: nil, request_options: nil)
82
- workspace_id = @core.resolve_default("workspaceId", "CADENYA_WORKSPACE_ID", workspace_id)
83
- _path = "/v1/workspaces/#{Util.path_param('workspaceId', workspace_id)}/agents/#{Util.path_param('agentId', agent_id)}/variations/#{Util.path_param('variationId', variation_id)}/assignments/#{Util.path_param('id', id)}"
84
- @core.request(:delete, _path, expects_body: false, request_options: request_options)
85
- nil
77
+ Types::AgentVariation.from_json(_data)
86
78
  end
87
79
 
88
80
  # Attach a memory layer to a variation
89
81
  def add_memory_layer(agent_id, variation_id, memory_layer_id:, workspace_id: nil, position: nil, request_options: nil)
90
82
  workspace_id = @core.resolve_default("workspaceId", "CADENYA_WORKSPACE_ID", workspace_id)
91
- _path = "/v1/workspaces/#{Util.path_param('workspaceId', workspace_id)}/agents/#{Util.path_param('agentId', agent_id)}/variations/#{Util.path_param('variationId', variation_id)}/memory_layer_assignments"
83
+ _path = "/v1/workspaces/#{Util.path_param('workspaceId', workspace_id)}/agents/#{Util.path_param('agentId', agent_id)}/variations/#{Util.path_param('variationId', variation_id)}:addMemoryLayer"
92
84
  _body = {
93
85
  "memoryLayerId" => memory_layer_id,
94
86
  "position" => position,
95
87
  }.reject { |_k, v| v.nil? }
96
88
  _data = @core.request(:post, _path, body: _body, request_options: request_options)
97
- Types::VariationMemoryLayerAssignment.from_json(_data)
89
+ Types::AgentVariation.from_json(_data)
90
+ end
91
+
92
+ # Remove an assignment from a variation
93
+ def remove_assignment(agent_id, variation_id, body:, workspace_id: nil, request_options: nil)
94
+ workspace_id = @core.resolve_default("workspaceId", "CADENYA_WORKSPACE_ID", workspace_id)
95
+ _path = "/v1/workspaces/#{Util.path_param('workspaceId', workspace_id)}/agents/#{Util.path_param('agentId', agent_id)}/variations/#{Util.path_param('variationId', variation_id)}:removeAssignment"
96
+ _data = @core.request(:post, _path, body: (->(_v) { Types.encode_RemoveAgentVariationAssignmentRequest(_v) }).call(body), request_options: request_options)
97
+ Types::AgentVariation.from_json(_data)
98
98
  end
99
99
 
100
100
  # Remove a memory layer assignment from a variation
101
- def remove_memory_layer(agent_id, variation_id, id, workspace_id: nil, request_options: nil)
101
+ def remove_memory_layer(agent_id, variation_id, memory_layer_id:, workspace_id: nil, request_options: nil)
102
102
  workspace_id = @core.resolve_default("workspaceId", "CADENYA_WORKSPACE_ID", workspace_id)
103
- _path = "/v1/workspaces/#{Util.path_param('workspaceId', workspace_id)}/agents/#{Util.path_param('agentId', agent_id)}/variations/#{Util.path_param('variationId', variation_id)}/memory_layer_assignments/#{Util.path_param('id', id)}"
104
- @core.request(:delete, _path, expects_body: false, request_options: request_options)
105
- nil
103
+ _path = "/v1/workspaces/#{Util.path_param('workspaceId', workspace_id)}/agents/#{Util.path_param('agentId', agent_id)}/variations/#{Util.path_param('variationId', variation_id)}:removeMemoryLayer"
104
+ _body = {
105
+ "memoryLayerId" => memory_layer_id,
106
+ }.reject { |_k, v| v.nil? }
107
+ _data = @core.request(:post, _path, body: _body, request_options: request_options)
108
+ Types::AgentVariation.from_json(_data)
106
109
  end
107
110
 
108
111
  # Update a variation's memory layer assignment
109
- def update_memory_layer(agent_id, variation_id, id, workspace_id: nil, position: nil, request_options: nil)
112
+ def update_memory_layer(agent_id, variation_id, memory_layer_id:, position:, workspace_id: nil, request_options: nil)
110
113
  workspace_id = @core.resolve_default("workspaceId", "CADENYA_WORKSPACE_ID", workspace_id)
111
- _path = "/v1/workspaces/#{Util.path_param('workspaceId', workspace_id)}/agents/#{Util.path_param('agentId', agent_id)}/variations/#{Util.path_param('variationId', variation_id)}/memory_layer_assignments/#{Util.path_param('id', id)}"
114
+ _path = "/v1/workspaces/#{Util.path_param('workspaceId', workspace_id)}/agents/#{Util.path_param('agentId', agent_id)}/variations/#{Util.path_param('variationId', variation_id)}:updateMemoryLayer"
112
115
  _body = {
116
+ "memoryLayerId" => memory_layer_id,
113
117
  "position" => position,
114
118
  }.reject { |_k, v| v.nil? }
115
- _data = @core.request(:patch, _path, body: _body, request_options: request_options)
116
- Types::VariationMemoryLayerAssignment.from_json(_data)
119
+ _data = @core.request(:post, _path, body: _body, request_options: request_options)
120
+ Types::AgentVariation.from_json(_data)
117
121
  end
118
122
  end
119
123
  end
@@ -44,10 +44,13 @@ module Cadenya
44
44
  end
45
45
 
46
46
  # Get an AI provider key by ID
47
- def retrieve(id, workspace_id: nil, request_options: nil)
47
+ def retrieve(id, workspace_id: nil, include_info: nil, request_options: nil)
48
48
  workspace_id = @core.resolve_default("workspaceId", "CADENYA_WORKSPACE_ID", workspace_id)
49
49
  _path = "/v1/workspaces/#{Util.path_param('workspaceId', workspace_id)}/ai_provider_keys/#{Util.path_param('id', id)}"
50
- _data = @core.request(:get, _path, request_options: request_options)
50
+ _query = {
51
+ "includeInfo" => include_info,
52
+ }
53
+ _data = @core.request(:get, _path, query: _query, request_options: request_options)
51
54
  Types::AIProviderKey.from_json(_data)
52
55
  end
53
56
 
@@ -60,13 +63,14 @@ module Cadenya
60
63
  end
61
64
 
62
65
  # Update an AI provider key
63
- def update(id, workspace_id: nil, metadata: nil, spec: nil, update_mask: nil, request_options: nil)
66
+ def update(id, workspace_id: nil, metadata: nil, spec: nil, update_mask: nil, credential_patch: nil, request_options: nil)
64
67
  workspace_id = @core.resolve_default("workspaceId", "CADENYA_WORKSPACE_ID", workspace_id)
65
68
  _path = "/v1/workspaces/#{Util.path_param('workspaceId', workspace_id)}/ai_provider_keys/#{Util.path_param('id', id)}"
66
69
  _body = {
67
70
  "metadata" => metadata.nil? ? nil : (->(_v) { Types.encode_UpdateResourceMetadata(_v) }).call(metadata),
68
71
  "spec" => spec.nil? ? nil : (->(_v) { Types.encode_AIProviderKeySpec(_v) }).call(spec),
69
72
  "updateMask" => update_mask,
73
+ "credentialPatch" => credential_patch.nil? ? nil : (->(_v) { Types.encode_AIProviderCredentialPatch(_v) }).call(credential_patch),
70
74
  }.reject { |_k, v| v.nil? }
71
75
  _data = @core.request(:patch, _path, body: _body, request_options: request_options)
72
76
  Types::AIProviderKey.from_json(_data)
@@ -9,6 +9,18 @@ module Cadenya
9
9
  @core = core
10
10
  end
11
11
 
12
+ # Create a model
13
+ def create(ai_provider_key_id, metadata:, spec:, workspace_id: nil, request_options: nil)
14
+ workspace_id = @core.resolve_default("workspaceId", "CADENYA_WORKSPACE_ID", workspace_id)
15
+ _path = "/v1/workspaces/#{Util.path_param('workspaceId', workspace_id)}/ai_provider_keys/#{Util.path_param('aiProviderKeyId', ai_provider_key_id)}/models"
16
+ _body = {
17
+ "metadata" => metadata.nil? ? nil : (->(_v) { Types.encode_CreateResourceMetadata(_v) }).call(metadata),
18
+ "spec" => spec.nil? ? nil : (->(_v) { Types.encode_ModelSpec(_v) }).call(spec),
19
+ }.reject { |_k, v| v.nil? }
20
+ _data = @core.request(:post, _path, body: _body, request_options: request_options)
21
+ Types::Model.from_json(_data)
22
+ end
23
+
12
24
  # List models
13
25
  def list(workspace_id: nil, limit: nil, cursor: nil, prefix: nil, query: nil, state: nil, ai_provider_key_id: nil, is_assigned: nil, labels: nil, sort_order: nil, include_info: nil, request_options: nil)
14
26
  workspace_id = @core.resolve_default("workspaceId", "CADENYA_WORKSPACE_ID", workspace_id)
@@ -41,6 +53,20 @@ module Cadenya
41
53
  Types::Model.from_json(_data)
42
54
  end
43
55
 
56
+ # Update a model
57
+ def update(id, workspace_id: nil, metadata: nil, spec: nil, pricing_override: nil, update_mask: nil, request_options: nil)
58
+ workspace_id = @core.resolve_default("workspaceId", "CADENYA_WORKSPACE_ID", workspace_id)
59
+ _path = "/v1/workspaces/#{Util.path_param('workspaceId', workspace_id)}/models/#{Util.path_param('id', id)}"
60
+ _body = {
61
+ "metadata" => metadata.nil? ? nil : (->(_v) { Types.encode_UpdateResourceMetadata(_v) }).call(metadata),
62
+ "spec" => spec.nil? ? nil : (->(_v) { Types.encode_ModelSpec(_v) }).call(spec),
63
+ "pricingOverride" => pricing_override.nil? ? nil : (->(_v) { Types.encode_ModelPricingOverride(_v) }).call(pricing_override),
64
+ "updateMask" => update_mask,
65
+ }.reject { |_k, v| v.nil? }
66
+ _data = @core.request(:patch, _path, body: _body, request_options: request_options)
67
+ Types::Model.from_json(_data)
68
+ end
69
+
44
70
  # Disable a model
45
71
  def disable(id, workspace_id: nil, request_options: nil)
46
72
  workspace_id = @core.resolve_default("workspaceId", "CADENYA_WORKSPACE_ID", workspace_id)
@@ -155,31 +155,6 @@ module Cadenya
155
155
  Types::ObjectiveFeedback.from_json(_data)
156
156
  end
157
157
 
158
- # List objective tasks
159
- def list_tasks(objective_id, workspace_id: nil, limit: nil, cursor: nil, sort_order: nil, request_options: nil)
160
- workspace_id = @core.resolve_default("workspaceId", "CADENYA_WORKSPACE_ID", workspace_id)
161
- _path = "/v1/workspaces/#{Util.path_param('workspaceId', workspace_id)}/objectives/#{Util.path_param('objectiveId', objective_id)}/tasks"
162
- _query = {
163
- "limit" => limit,
164
- "cursor" => cursor,
165
- "sortOrder" => sort_order,
166
- }
167
- _data = @core.request(:get, _path, query: _query, request_options: request_options) || {}
168
- _items = (_data["items"] || []).map { |item| Types::ObjectiveTask.from_json(item) }
169
- _next_cursor = (((_data)["pagination"] || {}))["nextCursor"].to_s
170
- Page.new(_items, _next_cursor) do |_c|
171
- list_tasks(objective_id, workspace_id: workspace_id, limit: limit, cursor: _c, sort_order: sort_order, request_options: request_options)
172
- end
173
- end
174
-
175
- # Get an objective task by ID
176
- def retrieve_task(objective_id, id, workspace_id: nil, request_options: nil)
177
- workspace_id = @core.resolve_default("workspaceId", "CADENYA_WORKSPACE_ID", workspace_id)
178
- _path = "/v1/workspaces/#{Util.path_param('workspaceId', workspace_id)}/objectives/#{Util.path_param('objectiveId', objective_id)}/tasks/#{Util.path_param('id', id)}"
179
- _data = @core.request(:get, _path, request_options: request_options)
180
- Types::ObjectiveTask.from_json(_data)
181
- end
182
-
183
158
  # List objective tool calls
184
159
  def list_tool_calls(objective_id, workspace_id: nil, limit: nil, cursor: nil, status: nil, include_info: nil, execution_status: nil, labels: nil, request_options: nil)
185
160
  workspace_id = @core.resolve_default("workspaceId", "CADENYA_WORKSPACE_ID", workspace_id)