Class: Cadenya::Resources::Models
- Inherits:
-
Object
- Object
- Cadenya::Resources::Models
- Defined in:
- lib/cadenya/resources/models.rb,
sig/cadenya/resources/models.rbs
Overview
Manage LLM models available to a workspace. Models represent provider and family pairs (e.g., "anthropic/claude-sonnet-4.6"). Workspaces are seeded with the supported models and you can enable or disable each one.
Instance Method Summary collapse
-
#disable(id, workspace_id: nil, request_options: {}) ⇒ Cadenya::Models::Model
Transitions a model to STATE_DISABLED.
-
#enable(id, workspace_id: nil, request_options: {}) ⇒ Cadenya::Models::Model
Transitions a model to STATE_ENABLED, making it available for agent variations in the workspace.
-
#initialize(client:) ⇒ Models
constructor
private
A new instance of Models.
-
#list(workspace_id: nil, ai_provider_key_id: nil, cursor: nil, include_info: nil, is_assigned: nil, labels: nil, limit: nil, prefix: nil, query: nil, sort_order: nil, state: nil, request_options: {}) ⇒ Cadenya::Internal::CursorPagination<Cadenya::Models::Model>
Some parameter documentations has been truncated, see Models::ModelListParams for more details.
-
#retrieve(id, workspace_id: nil, request_options: {}) ⇒ Cadenya::Models::Model
Retrieves a model by ID from the workspace.
-
#swap(workspace_id: nil, model_swaps: nil, request_options: {}) ⇒ Object
Reassigns agent variations from one model to another in bulk.
Constructor Details
#initialize(client:) ⇒ Models
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 Models.
180 181 182 |
# File 'lib/cadenya/resources/models.rb', line 180 def initialize(client:) @client = client end |
Instance Method Details
#disable(id, workspace_id: nil, request_options: {}) ⇒ Cadenya::Models::Model
Transitions a model to STATE_DISABLED. Fails while agent variations are still provisioned on the model; use :swapModelOnVariations to move them first.
106 107 108 109 110 111 112 113 114 115 116 117 118 |
# File 'lib/cadenya/resources/models.rb', line 106 def disable(id, params = {}) parsed, = Cadenya::ModelDisableParams.dump_request(params) workspace_id = parsed.delete(:workspace_id) do @client.workspace_id end @client.request( method: :post, path: ["v1/workspaces/%1$s/models/%2$s:disable", workspace_id, id], model: Cadenya::Model, options: ) end |
#enable(id, workspace_id: nil, request_options: {}) ⇒ Cadenya::Models::Model
Transitions a model to STATE_ENABLED, making it available for agent variations in the workspace
134 135 136 137 138 139 140 141 142 143 144 145 146 |
# File 'lib/cadenya/resources/models.rb', line 134 def enable(id, params = {}) parsed, = Cadenya::ModelEnableParams.dump_request(params) workspace_id = parsed.delete(:workspace_id) do @client.workspace_id end @client.request( method: :post, path: ["v1/workspaces/%1$s/models/%2$s:enable", workspace_id, id], model: Cadenya::Model, options: ) end |
#list(workspace_id: nil, ai_provider_key_id: nil, cursor: nil, include_info: nil, is_assigned: nil, labels: nil, limit: nil, prefix: nil, query: nil, sort_order: nil, state: nil, request_options: {}) ⇒ Cadenya::Internal::CursorPagination<Cadenya::Models::Model>
Some parameter documentations has been truncated, see Models::ModelListParams for more details.
Lists all models in the workspace
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 |
# File 'lib/cadenya/resources/models.rb', line 70 def list(params = {}) parsed, = Cadenya::ModelListParams.dump_request(params) query = Cadenya::Internal::Util.encode_query_params(parsed) workspace_id = parsed.delete(:workspace_id) do @client.workspace_id end @client.request( method: :get, path: ["v1/workspaces/%1$s/models", workspace_id], query: query.transform_keys( ai_provider_key_id: "aiProviderKeyId", include_info: "includeInfo", is_assigned: "isAssigned", sort_order: "sortOrder" ), page: Cadenya::Internal::CursorPagination, model: Cadenya::Model, options: ) end |
#retrieve(id, workspace_id: nil, request_options: {}) ⇒ Cadenya::Models::Model
Retrieves a model by ID from the workspace
22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/cadenya/resources/models.rb', line 22 def retrieve(id, params = {}) parsed, = Cadenya::ModelRetrieveParams.dump_request(params) workspace_id = parsed.delete(:workspace_id) do @client.workspace_id end @client.request( method: :get, path: ["v1/workspaces/%1$s/models/%2$s", workspace_id, id], model: Cadenya::Model, options: ) end |
#swap(workspace_id: nil, model_swaps: nil, request_options: {}) ⇒ Object
Reassigns agent variations from one model to another in bulk. Runs asynchronously and returns immediately.
162 163 164 165 166 167 168 169 170 171 172 173 174 175 |
# File 'lib/cadenya/resources/models.rb', line 162 def swap(params = {}) parsed, = Cadenya::ModelSwapParams.dump_request(params) workspace_id = parsed.delete(:workspace_id) do @client.workspace_id end @client.request( method: :post, path: ["v1/workspaces/%1$s/models:swapModelOnVariations", workspace_id], body: parsed, model: Cadenya::Internal::Type::Unknown, options: ) end |