Class: Cadenya::Resources::Models
- Inherits:
-
Object
- Object
- Cadenya::Resources::Models
- Defined in:
- lib/cadenya/resources/models.rb
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
-
#initialize(client:) ⇒ Models
constructor
private
A new instance of Models.
-
#list(workspace_id, bundle_key: nil, cursor: nil, limit: nil, prefix: nil, query: nil, sort_order: nil, status: nil, request_options: {}) ⇒ Cadenya::Internal::CursorPagination<Cadenya::Models::Model>
Lists all models in the workspace.
-
#retrieve(id, workspace_id:, request_options: {}) ⇒ Cadenya::Models::Model
Retrieves a model by ID from the workspace.
-
#set_status(id, workspace_id:, status: nil, request_options: {}) ⇒ Cadenya::Models::Model
Enables or disables a model in the workspace.
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.
107 108 109 |
# File 'lib/cadenya/resources/models.rb', line 107 def initialize(client:) @client = client end |
Instance Method Details
#list(workspace_id, bundle_key: nil, cursor: nil, limit: nil, prefix: nil, query: nil, sort_order: nil, status: nil, request_options: {}) ⇒ Cadenya::Internal::CursorPagination<Cadenya::Models::Model>
Lists all models in the workspace
61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/cadenya/resources/models.rb', line 61 def list(workspace_id, params = {}) parsed, = Cadenya::ModelListParams.dump_request(params) query = Cadenya::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: ["v1/workspaces/%1$s/models", workspace_id], query: query.transform_keys(bundle_key: "bundleKey", sort_order: "sortOrder"), page: Cadenya::Internal::CursorPagination, model: Cadenya::Model, options: ) end |
#retrieve(id, workspace_id:, 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 raise ArgumentError.new("missing required path argument #{_1}") end @client.request( method: :get, path: ["v1/workspaces/%1$s/models/%2$s", workspace_id, id], model: Cadenya::Model, options: ) end |
#set_status(id, workspace_id:, status: nil, request_options: {}) ⇒ Cadenya::Models::Model
Enables or disables a model in the workspace
89 90 91 92 93 94 95 96 97 98 99 100 101 102 |
# File 'lib/cadenya/resources/models.rb', line 89 def set_status(id, params) parsed, = Cadenya::ModelSetStatusParams.dump_request(params) workspace_id = parsed.delete(:workspace_id) do raise ArgumentError.new("missing required path argument #{_1}") end @client.request( method: :put, path: ["v1/workspaces/%1$s/models/%2$s/status", workspace_id, id], body: parsed, model: Cadenya::Model, options: ) end |