cadenya 1.7.0 → 1.9.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/README.md +1 -1
- data/api.md +54 -31
- data/lib/cadenya/client.rb +3 -2
- data/lib/cadenya/resources/api_keys.rb +43 -50
- data/lib/cadenya/resources/memory_layers.rb +7 -3
- data/lib/cadenya/resources/objectives.rb +10 -4
- data/lib/cadenya/resources/trusted_endpoints.rb +64 -0
- data/lib/cadenya/types.rb +900 -106
- data/lib/cadenya.rb +1 -0
- metadata +3 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: eecb6d4f82f8979e9e5b6353bba75ca96097bcfcba0b023a7287996f7867c04b
|
|
4
|
+
data.tar.gz: 6d65c5f9ea8484123b41c7de59968ef0bbd539e6521908ed4a48ed97a72211b9
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e0abbd8000d1341c0359001f98f057429b128b746b0244c930f160e4572c2fbb54b0459cbe1f6712dbf274c2de9d968ece4aa462e7d4087910cd021e7e5d8ecc
|
|
7
|
+
data.tar.gz: 77686a8de6a5595239d0ae18edd14a7c376a4ef130e556a00ab5c637d66de4c39ddb15b7d48aefad6ee126799bca5861fb46afce9425465b78542c0ce7e03d90
|
data/README.md
CHANGED
data/api.md
CHANGED
|
@@ -22,65 +22,60 @@ client.accounts.rotate_webhook_signing_key() # => Cadenya::Types::RotateWebhookE
|
|
|
22
22
|
|
|
23
23
|
## client.api_keys
|
|
24
24
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
```ruby
|
|
28
|
-
client.api_keys.retrieve_global() # => Cadenya::Types::APIKey
|
|
29
|
-
```
|
|
30
|
-
Disable the global API key
|
|
25
|
+
List API keys
|
|
31
26
|
|
|
32
27
|
```ruby
|
|
33
|
-
client.api_keys.
|
|
28
|
+
client.api_keys.list(workspace_id: nil, limit: nil, cursor: nil, prefix: nil, query: nil, labels: nil, sort_order: nil, include_info: nil) # => Cadenya::Page of Cadenya::Types::APIKey
|
|
34
29
|
```
|
|
35
|
-
|
|
30
|
+
Create a new API key
|
|
36
31
|
|
|
37
32
|
```ruby
|
|
38
|
-
client.api_keys.
|
|
33
|
+
client.api_keys.create(metadata:, spec:) # => Cadenya::Types::APIKey
|
|
39
34
|
```
|
|
40
|
-
|
|
35
|
+
Get an API key by ID
|
|
41
36
|
|
|
42
37
|
```ruby
|
|
43
|
-
client.api_keys.
|
|
38
|
+
client.api_keys.retrieve(id) # => Cadenya::Types::APIKey
|
|
44
39
|
```
|
|
45
|
-
|
|
40
|
+
Delete an API key
|
|
46
41
|
|
|
47
42
|
```ruby
|
|
48
|
-
client.api_keys.
|
|
43
|
+
client.api_keys.delete(id) # => nil
|
|
49
44
|
```
|
|
50
|
-
|
|
45
|
+
Update an API key
|
|
51
46
|
|
|
52
47
|
```ruby
|
|
53
|
-
client.api_keys.
|
|
48
|
+
client.api_keys.update(id, metadata: nil, spec: nil, update_mask: nil) # => Cadenya::Types::APIKey
|
|
54
49
|
```
|
|
55
|
-
|
|
50
|
+
Assign a workspace to an API key
|
|
56
51
|
|
|
57
52
|
```ruby
|
|
58
|
-
client.api_keys.
|
|
53
|
+
client.api_keys.add_workspace(id, workspace_id:) # => Cadenya::Types::APIKey
|
|
59
54
|
```
|
|
60
|
-
|
|
55
|
+
Disable an API key
|
|
61
56
|
|
|
62
57
|
```ruby
|
|
63
|
-
client.api_keys.
|
|
58
|
+
client.api_keys.disable(id) # => Cadenya::Types::APIKey
|
|
64
59
|
```
|
|
65
|
-
|
|
60
|
+
Enable an API key
|
|
66
61
|
|
|
67
62
|
```ruby
|
|
68
|
-
client.api_keys.
|
|
63
|
+
client.api_keys.enable(id) # => Cadenya::Types::APIKey
|
|
69
64
|
```
|
|
70
|
-
|
|
65
|
+
Remove a workspace from an API key
|
|
71
66
|
|
|
72
67
|
```ruby
|
|
73
|
-
client.api_keys.
|
|
68
|
+
client.api_keys.remove_workspace(id, workspace_id:) # => Cadenya::Types::APIKey
|
|
74
69
|
```
|
|
75
|
-
|
|
70
|
+
Reveal an API key's token
|
|
76
71
|
|
|
77
72
|
```ruby
|
|
78
|
-
client.api_keys.
|
|
73
|
+
client.api_keys.reveal(id) # => Cadenya::Types::APIKey
|
|
79
74
|
```
|
|
80
75
|
Rotate an API key
|
|
81
76
|
|
|
82
77
|
```ruby
|
|
83
|
-
client.api_keys.rotate(id
|
|
78
|
+
client.api_keys.rotate(id) # => Cadenya::Types::APIKey
|
|
84
79
|
```
|
|
85
80
|
|
|
86
81
|
## client.workspace_admin
|
|
@@ -131,6 +126,34 @@ Remove a member from a workspace
|
|
|
131
126
|
client.workspace_admin.remove_member(profile_id, workspace_id: nil) # => nil
|
|
132
127
|
```
|
|
133
128
|
|
|
129
|
+
## client.trusted_endpoints
|
|
130
|
+
|
|
131
|
+
List trusted endpoints
|
|
132
|
+
|
|
133
|
+
```ruby
|
|
134
|
+
client.trusted_endpoints.list(limit: nil, cursor: nil, labels: nil) # => Cadenya::Page of Cadenya::Types::TrustedEndpoint
|
|
135
|
+
```
|
|
136
|
+
Create a trusted endpoint
|
|
137
|
+
|
|
138
|
+
```ruby
|
|
139
|
+
client.trusted_endpoints.create(metadata:, spec:) # => Cadenya::Types::TrustedEndpoint
|
|
140
|
+
```
|
|
141
|
+
Get a trusted endpoint by ID
|
|
142
|
+
|
|
143
|
+
```ruby
|
|
144
|
+
client.trusted_endpoints.retrieve(id) # => Cadenya::Types::TrustedEndpoint
|
|
145
|
+
```
|
|
146
|
+
Delete a trusted endpoint
|
|
147
|
+
|
|
148
|
+
```ruby
|
|
149
|
+
client.trusted_endpoints.delete(id) # => nil
|
|
150
|
+
```
|
|
151
|
+
Verify a URL against the trusted endpoints
|
|
152
|
+
|
|
153
|
+
```ruby
|
|
154
|
+
client.trusted_endpoints.verify(url:) # => Cadenya::Types::VerifyTrustedEndpointResponse
|
|
155
|
+
```
|
|
156
|
+
|
|
134
157
|
## client.profiles
|
|
135
158
|
|
|
136
159
|
Retrieves the profile for the credentials accessing the API
|
|
@@ -420,12 +443,12 @@ client.models.swap_on_variations(workspace_id: nil, model_swaps: nil) # => nil
|
|
|
420
443
|
List memory layers
|
|
421
444
|
|
|
422
445
|
```ruby
|
|
423
|
-
client.memory_layers.list(workspace_id: nil, limit: nil, cursor: nil, prefix: nil, query: nil, type: nil, agent_id: nil, episodic_key_prefix: nil, labels: nil, sort_order: nil, include_info: nil) # => Cadenya::Page of Cadenya::Types::MemoryLayer
|
|
446
|
+
client.memory_layers.list(workspace_id: nil, limit: nil, cursor: nil, prefix: nil, query: nil, type: nil, agent_id: nil, episodic_key_prefix: nil, labels: nil, tenant_id: nil, subject_id: nil, sort_order: nil, include_info: nil) # => Cadenya::Page of Cadenya::Types::MemoryLayer
|
|
424
447
|
```
|
|
425
448
|
Create a new memory layer
|
|
426
449
|
|
|
427
450
|
```ruby
|
|
428
|
-
client.memory_layers.create(metadata:, spec:, workspace_id: nil) # => Cadenya::Types::MemoryLayer
|
|
451
|
+
client.memory_layers.create(metadata:, spec:, workspace_id: nil, tenant: nil, subject: nil) # => Cadenya::Types::MemoryLayer
|
|
429
452
|
```
|
|
430
453
|
Get a memory layer by ID
|
|
431
454
|
|
|
@@ -481,7 +504,7 @@ client.objectives.list(workspace_id: nil, limit: nil, cursor: nil, agent_id: nil
|
|
|
481
504
|
Create a new objective
|
|
482
505
|
|
|
483
506
|
```ruby
|
|
484
|
-
client.objectives.create(agent_id:, workspace_id: nil, variation_id: nil, metadata: nil, system_prompt_data: nil, first_user_message: nil, secrets: nil, memory_cascade: nil, first_user_message_data: nil, episodic_memory: nil, tenant: nil, subject: nil, pinned_parameters: nil) # => Cadenya::Types::Objective
|
|
507
|
+
client.objectives.create(agent_id:, workspace_id: nil, variation_id: nil, metadata: nil, system_prompt_data: nil, first_user_message: nil, secrets: nil, memory_cascade: nil, first_user_message_data: nil, episodic_memory: nil, tenant: nil, subject: nil, pinned_parameters: nil, client_tools: nil) # => Cadenya::Types::Objective
|
|
485
508
|
```
|
|
486
509
|
Get an objective by ID
|
|
487
510
|
|
|
@@ -506,7 +529,7 @@ client.objectives.list_events(objective_id, workspace_id: nil, limit: nil, curso
|
|
|
506
529
|
Stream objective events
|
|
507
530
|
|
|
508
531
|
```ruby
|
|
509
|
-
client.objectives.stream_events(objective_id, workspace_id: nil, last_event_id: nil) # => Cadenya::Stream
|
|
532
|
+
client.objectives.stream_events(objective_id, workspace_id: nil, include_deltas: nil, last_event_id: nil) # => Cadenya::Stream
|
|
510
533
|
```
|
|
511
534
|
List feedback for an objective
|
|
512
535
|
|
|
@@ -581,7 +604,7 @@ client.objectives.interrupt(objective_id, workspace_id: nil) # => Cadenya::Types
|
|
|
581
604
|
Create an objective and stream its events
|
|
582
605
|
|
|
583
606
|
```ruby
|
|
584
|
-
client.objectives.create_and_stream(agent_id:, metadata:, workspace_id: nil, variation_id: nil, system_prompt_data: nil, first_user_message: nil, secrets: nil, memory_cascade: nil, first_user_message_data: nil, episodic_memory: nil, tenant: nil, subject: nil, pinned_parameters: nil, last_event_id: nil) # => Cadenya::Stream
|
|
607
|
+
client.objectives.create_and_stream(agent_id:, metadata:, workspace_id: nil, variation_id: nil, system_prompt_data: nil, first_user_message: nil, secrets: nil, memory_cascade: nil, first_user_message_data: nil, episodic_memory: nil, tenant: nil, subject: nil, pinned_parameters: nil, client_tools: nil, include_deltas: nil, last_event_id: nil) # => Cadenya::Stream
|
|
585
608
|
```
|
|
586
609
|
|
|
587
610
|
## client.tool_search
|
data/lib/cadenya/client.rb
CHANGED
|
@@ -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, :agent_pools, :agents, :ai_provider_keys, :models, :memory_layers, :objectives, :tool_search, :tenants, :tool_sets, :uploads, :widget_sessions, :widgets, :workspace_secrets
|
|
11
|
+
attr_reader :accounts, :api_keys, :workspace_admin, :trusted_endpoints, :profiles, :workspaces, :agent_pools, :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,13 +37,14 @@ 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.
|
|
40
|
+
user_agent: "cadenya-ruby/1.7.0 (api 1.0)",
|
|
41
41
|
connection: connection,
|
|
42
42
|
stream_transport: stream_transport
|
|
43
43
|
)
|
|
44
44
|
@accounts = Resources::Accounts.new(core)
|
|
45
45
|
@api_keys = Resources::ApiKeys.new(core)
|
|
46
46
|
@workspace_admin = Resources::WorkspaceAdmin.new(core)
|
|
47
|
+
@trusted_endpoints = Resources::TrustedEndpoints.new(core)
|
|
47
48
|
@profiles = Resources::Profiles.new(core)
|
|
48
49
|
@workspaces = Resources::Workspaces.new(core)
|
|
49
50
|
@agent_pools = Resources::AgentPools.new(core)
|
|
@@ -9,39 +9,12 @@ module Cadenya
|
|
|
9
9
|
@core = core
|
|
10
10
|
end
|
|
11
11
|
|
|
12
|
-
# Get the global API key
|
|
13
|
-
def retrieve_global(request_options: nil)
|
|
14
|
-
_path = "/v1/account/global_api_key"
|
|
15
|
-
_data = @core.request(:get, _path, request_options: request_options)
|
|
16
|
-
Types::APIKey.from_json(_data)
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
# Disable the global API key
|
|
20
|
-
def disable_global(request_options: nil)
|
|
21
|
-
_path = "/v1/account/global_api_key:disable"
|
|
22
|
-
_data = @core.request(:post, _path, request_options: request_options)
|
|
23
|
-
Types::APIKey.from_json(_data)
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
# Enable the global API key
|
|
27
|
-
def enable_global(request_options: nil)
|
|
28
|
-
_path = "/v1/account/global_api_key:enable"
|
|
29
|
-
_data = @core.request(:post, _path, request_options: request_options)
|
|
30
|
-
Types::APIKey.from_json(_data)
|
|
31
|
-
end
|
|
32
|
-
|
|
33
|
-
# Rotate the global API key
|
|
34
|
-
def rotate_global(request_options: nil)
|
|
35
|
-
_path = "/v1/account/global_api_key:rotate"
|
|
36
|
-
_data = @core.request(:post, _path, request_options: request_options)
|
|
37
|
-
Types::APIKey.from_json(_data)
|
|
38
|
-
end
|
|
39
|
-
|
|
40
12
|
# List API keys
|
|
41
13
|
def list(workspace_id: nil, limit: nil, cursor: nil, prefix: nil, query: nil, labels: nil, sort_order: nil, include_info: nil, request_options: nil)
|
|
42
14
|
workspace_id = @core.resolve_default("workspaceId", "CADENYA_WORKSPACE_ID", workspace_id)
|
|
43
|
-
_path = "/v1/
|
|
15
|
+
_path = "/v1/account/api_keys"
|
|
44
16
|
_query = {
|
|
17
|
+
"workspaceId" => workspace_id,
|
|
45
18
|
"limit" => limit,
|
|
46
19
|
"cursor" => cursor,
|
|
47
20
|
"prefix" => prefix,
|
|
@@ -59,9 +32,8 @@ module Cadenya
|
|
|
59
32
|
end
|
|
60
33
|
|
|
61
34
|
# Create a new API key
|
|
62
|
-
def create(metadata:, spec:,
|
|
63
|
-
|
|
64
|
-
_path = "/v1/workspaces/#{Util.path_param('workspaceId', workspace_id)}/api_keys"
|
|
35
|
+
def create(metadata:, spec:, request_options: nil)
|
|
36
|
+
_path = "/v1/account/api_keys"
|
|
65
37
|
_body = {
|
|
66
38
|
"metadata" => metadata.nil? ? nil : (->(_v) { Types.encode_CreateAccountResourceMetadata(_v) }).call(metadata),
|
|
67
39
|
"spec" => spec.nil? ? nil : (->(_v) { Types.encode_APIKeySpec(_v) }).call(spec),
|
|
@@ -71,25 +43,22 @@ module Cadenya
|
|
|
71
43
|
end
|
|
72
44
|
|
|
73
45
|
# Get an API key by ID
|
|
74
|
-
def retrieve(id,
|
|
75
|
-
|
|
76
|
-
_path = "/v1/workspaces/#{Util.path_param('workspaceId', workspace_id)}/api_keys/#{Util.path_param('id', id)}"
|
|
46
|
+
def retrieve(id, request_options: nil)
|
|
47
|
+
_path = "/v1/account/api_keys/#{Util.path_param('id', id)}"
|
|
77
48
|
_data = @core.request(:get, _path, request_options: request_options)
|
|
78
49
|
Types::APIKey.from_json(_data)
|
|
79
50
|
end
|
|
80
51
|
|
|
81
52
|
# Delete an API key
|
|
82
|
-
def delete(id,
|
|
83
|
-
|
|
84
|
-
_path = "/v1/workspaces/#{Util.path_param('workspaceId', workspace_id)}/api_keys/#{Util.path_param('id', id)}"
|
|
53
|
+
def delete(id, request_options: nil)
|
|
54
|
+
_path = "/v1/account/api_keys/#{Util.path_param('id', id)}"
|
|
85
55
|
@core.request(:delete, _path, expects_body: false, request_options: request_options)
|
|
86
56
|
nil
|
|
87
57
|
end
|
|
88
58
|
|
|
89
59
|
# Update an API key
|
|
90
|
-
def update(id,
|
|
91
|
-
|
|
92
|
-
_path = "/v1/workspaces/#{Util.path_param('workspaceId', workspace_id)}/api_keys/#{Util.path_param('id', id)}"
|
|
60
|
+
def update(id, metadata: nil, spec: nil, update_mask: nil, request_options: nil)
|
|
61
|
+
_path = "/v1/account/api_keys/#{Util.path_param('id', id)}"
|
|
93
62
|
_body = {
|
|
94
63
|
"metadata" => metadata.nil? ? nil : (->(_v) { Types.encode_UpdateAccountResourceMetadata(_v) }).call(metadata),
|
|
95
64
|
"spec" => spec.nil? ? nil : (->(_v) { Types.encode_APIKeySpec(_v) }).call(spec),
|
|
@@ -99,26 +68,50 @@ module Cadenya
|
|
|
99
68
|
Types::APIKey.from_json(_data)
|
|
100
69
|
end
|
|
101
70
|
|
|
71
|
+
# Assign a workspace to an API key
|
|
72
|
+
def add_workspace(id, workspace_id:, request_options: nil)
|
|
73
|
+
_path = "/v1/account/api_keys/#{Util.path_param('id', id)}:addWorkspace"
|
|
74
|
+
_body = {
|
|
75
|
+
"workspaceId" => workspace_id,
|
|
76
|
+
}.reject { |_k, v| v.nil? }
|
|
77
|
+
_data = @core.request(:post, _path, body: _body, request_options: request_options)
|
|
78
|
+
Types::APIKey.from_json(_data)
|
|
79
|
+
end
|
|
80
|
+
|
|
102
81
|
# Disable an API key
|
|
103
|
-
def disable(id,
|
|
104
|
-
|
|
105
|
-
_path = "/v1/workspaces/#{Util.path_param('workspaceId', workspace_id)}/api_keys/#{Util.path_param('id', id)}:disable"
|
|
82
|
+
def disable(id, request_options: nil)
|
|
83
|
+
_path = "/v1/account/api_keys/#{Util.path_param('id', id)}:disable"
|
|
106
84
|
_data = @core.request(:post, _path, request_options: request_options)
|
|
107
85
|
Types::APIKey.from_json(_data)
|
|
108
86
|
end
|
|
109
87
|
|
|
110
88
|
# Enable an API key
|
|
111
|
-
def enable(id,
|
|
112
|
-
|
|
113
|
-
|
|
89
|
+
def enable(id, request_options: nil)
|
|
90
|
+
_path = "/v1/account/api_keys/#{Util.path_param('id', id)}:enable"
|
|
91
|
+
_data = @core.request(:post, _path, request_options: request_options)
|
|
92
|
+
Types::APIKey.from_json(_data)
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
# Remove a workspace from an API key
|
|
96
|
+
def remove_workspace(id, workspace_id:, request_options: nil)
|
|
97
|
+
_path = "/v1/account/api_keys/#{Util.path_param('id', id)}:removeWorkspace"
|
|
98
|
+
_body = {
|
|
99
|
+
"workspaceId" => workspace_id,
|
|
100
|
+
}.reject { |_k, v| v.nil? }
|
|
101
|
+
_data = @core.request(:post, _path, body: _body, request_options: request_options)
|
|
102
|
+
Types::APIKey.from_json(_data)
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
# Reveal an API key's token
|
|
106
|
+
def reveal(id, request_options: nil)
|
|
107
|
+
_path = "/v1/account/api_keys/#{Util.path_param('id', id)}:reveal"
|
|
114
108
|
_data = @core.request(:post, _path, request_options: request_options)
|
|
115
109
|
Types::APIKey.from_json(_data)
|
|
116
110
|
end
|
|
117
111
|
|
|
118
112
|
# Rotate an API key
|
|
119
|
-
def rotate(id,
|
|
120
|
-
|
|
121
|
-
_path = "/v1/workspaces/#{Util.path_param('workspaceId', workspace_id)}/api_keys/#{Util.path_param('id', id)}:rotate"
|
|
113
|
+
def rotate(id, request_options: nil)
|
|
114
|
+
_path = "/v1/account/api_keys/#{Util.path_param('id', id)}:rotate"
|
|
122
115
|
_data = @core.request(:post, _path, request_options: request_options)
|
|
123
116
|
Types::APIKey.from_json(_data)
|
|
124
117
|
end
|
|
@@ -13,7 +13,7 @@ module Cadenya
|
|
|
13
13
|
end
|
|
14
14
|
|
|
15
15
|
# List memory layers
|
|
16
|
-
def list(workspace_id: nil, limit: nil, cursor: nil, prefix: nil, query: nil, type: nil, agent_id: nil, episodic_key_prefix: nil, labels: nil, sort_order: nil, include_info: nil, request_options: nil)
|
|
16
|
+
def list(workspace_id: nil, limit: nil, cursor: nil, prefix: nil, query: nil, type: nil, agent_id: nil, episodic_key_prefix: nil, labels: nil, tenant_id: nil, subject_id: nil, sort_order: nil, include_info: nil, request_options: nil)
|
|
17
17
|
workspace_id = @core.resolve_default("workspaceId", "CADENYA_WORKSPACE_ID", workspace_id)
|
|
18
18
|
_path = "/v1/workspaces/#{Util.path_param('workspaceId', workspace_id)}/memory_layers"
|
|
19
19
|
_query = {
|
|
@@ -25,6 +25,8 @@ module Cadenya
|
|
|
25
25
|
"agentId" => agent_id,
|
|
26
26
|
"episodicKeyPrefix" => episodic_key_prefix,
|
|
27
27
|
"labels" => labels,
|
|
28
|
+
"tenantId" => tenant_id,
|
|
29
|
+
"subjectId" => subject_id,
|
|
28
30
|
"sortOrder" => sort_order,
|
|
29
31
|
"includeInfo" => include_info,
|
|
30
32
|
}
|
|
@@ -32,17 +34,19 @@ module Cadenya
|
|
|
32
34
|
_items = (_data["items"] || []).map { |item| Types::MemoryLayer.from_json(item) }
|
|
33
35
|
_next_cursor = (((_data)["pagination"] || {}))["nextCursor"].to_s
|
|
34
36
|
Page.new(_items, _next_cursor) do |_c|
|
|
35
|
-
list(workspace_id: workspace_id, limit: limit, cursor: _c, prefix: prefix, query: query, type: type, agent_id: agent_id, episodic_key_prefix: episodic_key_prefix, labels: labels, sort_order: sort_order, include_info: include_info, request_options: request_options)
|
|
37
|
+
list(workspace_id: workspace_id, limit: limit, cursor: _c, prefix: prefix, query: query, type: type, agent_id: agent_id, episodic_key_prefix: episodic_key_prefix, labels: labels, tenant_id: tenant_id, subject_id: subject_id, sort_order: sort_order, include_info: include_info, request_options: request_options)
|
|
36
38
|
end
|
|
37
39
|
end
|
|
38
40
|
|
|
39
41
|
# Create a new memory layer
|
|
40
|
-
def create(metadata:, spec:, workspace_id: nil, request_options: nil)
|
|
42
|
+
def create(metadata:, spec:, workspace_id: nil, tenant: nil, subject: nil, request_options: nil)
|
|
41
43
|
workspace_id = @core.resolve_default("workspaceId", "CADENYA_WORKSPACE_ID", workspace_id)
|
|
42
44
|
_path = "/v1/workspaces/#{Util.path_param('workspaceId', workspace_id)}/memory_layers"
|
|
43
45
|
_body = {
|
|
44
46
|
"metadata" => metadata.nil? ? nil : (->(_v) { Types.encode_CreateResourceMetadata(_v) }).call(metadata),
|
|
45
47
|
"spec" => spec.nil? ? nil : (->(_v) { Types.encode_MemoryLayerSpec(_v) }).call(spec),
|
|
48
|
+
"tenant" => tenant.nil? ? nil : (->(_v) { Types.encode_TenantAssertion(_v) }).call(tenant),
|
|
49
|
+
"subject" => subject.nil? ? nil : (->(_v) { Types.encode_SubjectAssertion(_v) }).call(subject),
|
|
46
50
|
}.reject { |_k, v| v.nil? }
|
|
47
51
|
_data = @core.request(:post, _path, body: _body, request_options: request_options)
|
|
48
52
|
Types::MemoryLayer.from_json(_data)
|
|
@@ -38,7 +38,7 @@ module Cadenya
|
|
|
38
38
|
end
|
|
39
39
|
|
|
40
40
|
# Create a new objective
|
|
41
|
-
def create(agent_id:, workspace_id: nil, variation_id: nil, metadata: nil, system_prompt_data: nil, first_user_message: nil, secrets: nil, memory_cascade: nil, first_user_message_data: nil, episodic_memory: nil, tenant: nil, subject: nil, pinned_parameters: nil, request_options: nil)
|
|
41
|
+
def create(agent_id:, workspace_id: nil, variation_id: nil, metadata: nil, system_prompt_data: nil, first_user_message: nil, secrets: nil, memory_cascade: nil, first_user_message_data: nil, episodic_memory: nil, tenant: nil, subject: nil, pinned_parameters: nil, client_tools: nil, request_options: nil)
|
|
42
42
|
workspace_id = @core.resolve_default("workspaceId", "CADENYA_WORKSPACE_ID", workspace_id)
|
|
43
43
|
_path = "/v1/workspaces/#{Util.path_param('workspaceId', workspace_id)}/objectives"
|
|
44
44
|
_body = {
|
|
@@ -54,6 +54,7 @@ module Cadenya
|
|
|
54
54
|
"tenant" => tenant.nil? ? nil : (->(_v) { Types.encode_TenantAssertion(_v) }).call(tenant),
|
|
55
55
|
"subject" => subject.nil? ? nil : (->(_v) { Types.encode_SubjectAssertion(_v) }).call(subject),
|
|
56
56
|
"pinnedParameters" => pinned_parameters,
|
|
57
|
+
"clientTools" => client_tools.nil? ? nil : (->(_v) { Types.encode_ClientTools(_v) }).call(client_tools),
|
|
57
58
|
}.reject { |_k, v| v.nil? }
|
|
58
59
|
_data = @core.request(:post, _path, body: _body, request_options: request_options)
|
|
59
60
|
Types::Objective.from_json(_data)
|
|
@@ -115,14 +116,17 @@ module Cadenya
|
|
|
115
116
|
end
|
|
116
117
|
|
|
117
118
|
# Stream objective events
|
|
118
|
-
def stream_events(objective_id, workspace_id: nil, last_event_id: nil, request_options: nil)
|
|
119
|
+
def stream_events(objective_id, workspace_id: nil, include_deltas: nil, last_event_id: nil, request_options: nil)
|
|
119
120
|
workspace_id = @core.resolve_default("workspaceId", "CADENYA_WORKSPACE_ID", workspace_id)
|
|
120
121
|
_path = "/v1/workspaces/#{Util.path_param('workspaceId', workspace_id)}/objectives/#{Util.path_param('objectiveId', objective_id)}/events:stream"
|
|
122
|
+
_query = {
|
|
123
|
+
"includeDeltas" => include_deltas,
|
|
124
|
+
}
|
|
121
125
|
_headers = last_event_id ? { "Last-Event-ID" => last_event_id } : nil
|
|
122
126
|
_decoder = ->(event) { Types::ObjectiveEvent.from_json(event) }
|
|
123
127
|
_auto_reconnect = !(request_options && request_options[:reconnect] == false)
|
|
124
128
|
Stream.new(_decoder, last_event_id: last_event_id, skip_events: ["ping", "open"], auto_reconnect: _auto_reconnect) do |_cancel, _resume, &on_chunk|
|
|
125
|
-
@core.stream_request(:get, _path, headers: (_resume ? { "Last-Event-ID" => _resume } : nil), request_options: request_options, cancel: _cancel, &on_chunk)
|
|
129
|
+
@core.stream_request(:get, _path, query: _query, headers: (_resume ? { "Last-Event-ID" => _resume } : nil), request_options: request_options, cancel: _cancel, &on_chunk)
|
|
126
130
|
end
|
|
127
131
|
end
|
|
128
132
|
|
|
@@ -297,7 +301,7 @@ module Cadenya
|
|
|
297
301
|
end
|
|
298
302
|
|
|
299
303
|
# Create an objective and stream its events
|
|
300
|
-
def create_and_stream(agent_id:, metadata:, workspace_id: nil, variation_id: nil, system_prompt_data: nil, first_user_message: nil, secrets: nil, memory_cascade: nil, first_user_message_data: nil, episodic_memory: nil, tenant: nil, subject: nil, pinned_parameters: nil, last_event_id: nil, request_options: nil)
|
|
304
|
+
def create_and_stream(agent_id:, metadata:, workspace_id: nil, variation_id: nil, system_prompt_data: nil, first_user_message: nil, secrets: nil, memory_cascade: nil, first_user_message_data: nil, episodic_memory: nil, tenant: nil, subject: nil, pinned_parameters: nil, client_tools: nil, include_deltas: nil, last_event_id: nil, request_options: nil)
|
|
301
305
|
workspace_id = @core.resolve_default("workspaceId", "CADENYA_WORKSPACE_ID", workspace_id)
|
|
302
306
|
_path = "/v1/workspaces/#{Util.path_param('workspaceId', workspace_id)}/objectives:stream"
|
|
303
307
|
_body = {
|
|
@@ -313,6 +317,8 @@ module Cadenya
|
|
|
313
317
|
"tenant" => tenant.nil? ? nil : (->(_v) { Types.encode_TenantAssertion(_v) }).call(tenant),
|
|
314
318
|
"subject" => subject.nil? ? nil : (->(_v) { Types.encode_SubjectAssertion(_v) }).call(subject),
|
|
315
319
|
"pinnedParameters" => pinned_parameters,
|
|
320
|
+
"clientTools" => client_tools.nil? ? nil : (->(_v) { Types.encode_ClientTools(_v) }).call(client_tools),
|
|
321
|
+
"includeDeltas" => include_deltas,
|
|
316
322
|
}.reject { |_k, v| v.nil? }
|
|
317
323
|
_headers = last_event_id ? { "Last-Event-ID" => last_event_id } : nil
|
|
318
324
|
_decoder = ->(event) { Types.decode_CreateAndStreamObjectiveResponse(event) }
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Code generated by redwood. DO NOT EDIT.
|
|
4
|
+
|
|
5
|
+
module Cadenya
|
|
6
|
+
module Resources
|
|
7
|
+
class TrustedEndpoints
|
|
8
|
+
def initialize(core)
|
|
9
|
+
@core = core
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
# List trusted endpoints
|
|
13
|
+
def list(limit: nil, cursor: nil, labels: nil, request_options: nil)
|
|
14
|
+
_path = "/v1/account/trusted_endpoints"
|
|
15
|
+
_query = {
|
|
16
|
+
"limit" => limit,
|
|
17
|
+
"cursor" => cursor,
|
|
18
|
+
"labels" => labels,
|
|
19
|
+
}
|
|
20
|
+
_data = @core.request(:get, _path, query: _query, request_options: request_options) || {}
|
|
21
|
+
_items = (_data["items"] || []).map { |item| Types::TrustedEndpoint.from_json(item) }
|
|
22
|
+
_next_cursor = (((_data)["pagination"] || {}))["nextCursor"].to_s
|
|
23
|
+
Page.new(_items, _next_cursor) do |_c|
|
|
24
|
+
list(limit: limit, cursor: _c, labels: labels, request_options: request_options)
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
# Create a trusted endpoint
|
|
29
|
+
def create(metadata:, spec:, request_options: nil)
|
|
30
|
+
_path = "/v1/account/trusted_endpoints"
|
|
31
|
+
_body = {
|
|
32
|
+
"metadata" => metadata.nil? ? nil : (->(_v) { Types.encode_CreateAccountResourceMetadata(_v) }).call(metadata),
|
|
33
|
+
"spec" => spec.nil? ? nil : (->(_v) { Types.encode_TrustedEndpointSpec(_v) }).call(spec),
|
|
34
|
+
}.reject { |_k, v| v.nil? }
|
|
35
|
+
_data = @core.request(:post, _path, body: _body, request_options: request_options)
|
|
36
|
+
Types::TrustedEndpoint.from_json(_data)
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
# Get a trusted endpoint by ID
|
|
40
|
+
def retrieve(id, request_options: nil)
|
|
41
|
+
_path = "/v1/account/trusted_endpoints/#{Util.path_param('id', id)}"
|
|
42
|
+
_data = @core.request(:get, _path, request_options: request_options)
|
|
43
|
+
Types::TrustedEndpoint.from_json(_data)
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
# Delete a trusted endpoint
|
|
47
|
+
def delete(id, request_options: nil)
|
|
48
|
+
_path = "/v1/account/trusted_endpoints/#{Util.path_param('id', id)}"
|
|
49
|
+
@core.request(:delete, _path, expects_body: false, request_options: request_options)
|
|
50
|
+
nil
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
# Verify a URL against the trusted endpoints
|
|
54
|
+
def verify(url:, request_options: nil)
|
|
55
|
+
_path = "/v1/account/trusted_endpoints:verify"
|
|
56
|
+
_body = {
|
|
57
|
+
"url" => url,
|
|
58
|
+
}.reject { |_k, v| v.nil? }
|
|
59
|
+
_data = @core.request(:post, _path, body: _body, request_options: request_options)
|
|
60
|
+
Types::VerifyTrustedEndpointResponse.from_json(_data)
|
|
61
|
+
end
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
end
|