Class: Cadenya::Resources::MemoryLayers

Inherits:
Object
  • Object
show all
Defined in:
lib/cadenya/resources/memory_layers.rb,
lib/cadenya/resources/memory_layers/entries.rb

Overview

Manage memory layers and their entries. Layers are named containers that can be composed into an objective’s memory stack; entries are the keyed values within a layer. System-managed layers (e.g., episodic layers created by the runtime) cannot be mutated through this API.

Defined Under Namespace

Classes: Entries

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ MemoryLayers

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 MemoryLayers.

Parameters:



185
186
187
188
# File 'lib/cadenya/resources/memory_layers.rb', line 185

def initialize(client:)
  @client = client
  @entries = Cadenya::Resources::MemoryLayers::Entries.new(client: client)
end

Instance Attribute Details

#entriesCadenya::Resources::MemoryLayers::Entries (readonly)

Manage memory layers and their entries. Layers are named containers that can be composed into an objective’s memory stack; entries are the keyed values within a layer. System-managed layers (e.g., episodic layers created by the runtime) cannot be mutated through this API.



15
16
17
# File 'lib/cadenya/resources/memory_layers.rb', line 15

def entries
  @entries
end

Instance Method Details

#create(workspace_id, metadata:, spec:, request_options: {}) ⇒ Cadenya::Models::MemoryLayer

Some parameter documentations has been truncated, see Models::MemoryLayerCreateParams for more details.

Creates a new memory layer in the workspace

Parameters:

Returns:

See Also:



35
36
37
38
39
40
41
42
43
44
# File 'lib/cadenya/resources/memory_layers.rb', line 35

def create(workspace_id, params)
  parsed, options = Cadenya::MemoryLayerCreateParams.dump_request(params)
  @client.request(
    method: :post,
    path: ["v1/workspaces/%1$s/memory_layers", workspace_id],
    body: parsed,
    model: Cadenya::MemoryLayer,
    options: options
  )
end

#delete(id, workspace_id:, request_options: {}) ⇒ nil

Deletes a memory layer from the workspace

Parameters:

  • id (String)

    Memory layer ID. Accepts canonical memlyr_… form or external_id:<value> form.

  • workspace_id (String)
  • request_options (Cadenya::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

  • (nil)

See Also:



168
169
170
171
172
173
174
175
176
177
178
179
180
# File 'lib/cadenya/resources/memory_layers.rb', line 168

def delete(id, params)
  parsed, options = Cadenya::MemoryLayerDeleteParams.dump_request(params)
  workspace_id =
    parsed.delete(:workspace_id) do
      raise ArgumentError.new("missing required path argument #{_1}")
    end
  @client.request(
    method: :delete,
    path: ["v1/workspaces/%1$s/memory_layers/%2$s", workspace_id, id],
    model: NilClass,
    options: options
  )
end

#list(workspace_id, bundle_key: nil, cursor: nil, include_info: nil, limit: nil, prefix: nil, query: nil, sort_order: nil, type: nil, request_options: {}) ⇒ Cadenya::Internal::CursorPagination<Cadenya::Models::MemoryLayer>

Lists all memory layers in the workspace

Parameters:

  • workspace_id (String)
  • bundle_key (String)

    Filter by bundle_key — return only resources owned by this bundle.

  • cursor (String)

    Pagination cursor from previous response

  • include_info (Boolean)

    When set to true you may use more of your alloted API rate-limit

  • limit (Integer)

    Maximum number of results to return

  • prefix (String)

    Filter expression (query param: prefix)

  • query (String)

    Free-form search query

  • sort_order (String)

    Sort order for results (asc or desc by creation time)

  • type (Symbol, Cadenya::Models::MemoryLayerListParams::Type)

    Filter by layer type

  • request_options (Cadenya::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
# File 'lib/cadenya/resources/memory_layers.rb', line 138

def list(workspace_id, params = {})
  parsed, options = Cadenya::MemoryLayerListParams.dump_request(params)
  query = Cadenya::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: ["v1/workspaces/%1$s/memory_layers", workspace_id],
    query: query.transform_keys(
      bundle_key: "bundleKey",
      include_info: "includeInfo",
      sort_order: "sortOrder"
    ),
    page: Cadenya::Internal::CursorPagination,
    model: Cadenya::MemoryLayer,
    options: options
  )
end

#retrieve(id, workspace_id:, request_options: {}) ⇒ Cadenya::Models::MemoryLayer

Retrieves a memory layer by ID from the workspace

Parameters:

  • id (String)

    Memory layer ID. Accepts canonical memlyr_… form or external_id:<value> form.

  • workspace_id (String)
  • request_options (Cadenya::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



59
60
61
62
63
64
65
66
67
68
69
70
71
# File 'lib/cadenya/resources/memory_layers.rb', line 59

def retrieve(id, params)
  parsed, options = Cadenya::MemoryLayerRetrieveParams.dump_request(params)
  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/memory_layers/%2$s", workspace_id, id],
    model: Cadenya::MemoryLayer,
    options: options
  )
end

#update(id, workspace_id:, metadata: nil, spec: nil, update_mask: nil, request_options: {}) ⇒ Cadenya::Models::MemoryLayer

Some parameter documentations has been truncated, see Models::MemoryLayerUpdateParams for more details.

Updates a memory layer in the workspace

external_id:<val

Parameters:

Returns:

See Also:



96
97
98
99
100
101
102
103
104
105
106
107
108
109
# File 'lib/cadenya/resources/memory_layers.rb', line 96

def update(id, params)
  parsed, options = Cadenya::MemoryLayerUpdateParams.dump_request(params)
  workspace_id =
    parsed.delete(:workspace_id) do
      raise ArgumentError.new("missing required path argument #{_1}")
    end
  @client.request(
    method: :patch,
    path: ["v1/workspaces/%1$s/memory_layers/%2$s", workspace_id, id],
    body: parsed,
    model: Cadenya::MemoryLayer,
    options: options
  )
end