Removes models from your account's model list. The operation ignores models that aren't on the list. WorkSpaces and persona configurations that use a removed model continue to reference it in their configuration, but the service blocks requests to the model. Your account must keep at least one model. If the request would remove the last model, the operation returns ValidationException.
Parameters:
-
model_ids
(AccountModelIdList)
–
The identifiers of the models to remove from your account's model list.
Raises:
-
AccessDeniedException
–
The user is not authorized to access a resource.
-
ConflictException
–
The request conflicts with the current state of a resource, for example because a name is already in use or the resource is still in use. Resolve the conflict, and then retry your request.
-
ThrottlingException
–
The request was throttled. Retry the request with exponential backoff.
-
ValidationException
–
Your request failed validation. Check the error message for the parameter that isn't valid.
-
UnknownServiceError
–
The service returned an error code this client does not model.
Examples:
Example – Removing models from an account
The following example removes two models from the account's model list.
>>> client.disassociate_account_models(model_ids=['anthropic.claude-opus-5-5', 'anthropic.claude-haiku-5-5'])
Source code in docs_src/capo_workspaces/_services/work_spaces.py
| def disassociate_account_models(
self,
model_ids: "capo_workspaces.types.account_model_id_list.AccountModelIdList",
*,
config_overrides: Optional[WorkSpacesClientConfig] = None,
) -> "capo_workspaces.types.disassociate_account_models_result.DisassociateAccountModelsResult":
"""<p>Removes models from your account's model list. The operation ignores models that aren't on the list. WorkSpaces and persona configurations that use a removed model continue to reference it in their configuration, but the service blocks requests to the model. Your account must keep at least one model. If the request would remove the last model, the operation returns <code>ValidationException</code>.</p>
Args:
model_ids: <p>The identifiers of the models to remove from your account's model list.</p>
Raises:
capo_workspaces.errors.access_denied_exception.AccessDeniedException: <p>The user is not authorized to access a resource.</p>
capo_workspaces.errors.conflict_exception.ConflictException: <p>The request conflicts with the current state of a resource, for example because a name is already in use or the resource is still in use. Resolve the conflict, and then retry your request.</p>
capo_workspaces.errors.throttling_exception.ThrottlingException: <p>The request was throttled. Retry the request with exponential backoff.</p>
capo_workspaces.errors.validation_exception.ValidationException: <p>Your request failed validation. Check the error message for the parameter that isn't valid.</p>
capo_workspaces.errors.UnknownServiceError: The service returned an error code this client does not model.
Examples:
Example – Removing models from an account
The following example removes two models from the account's model list.
>>> client.disassociate_account_models(model_ids=['anthropic.claude-opus-5-5', 'anthropic.claude-haiku-5-5'])
"""
def _handler(
req: "OperationRequest[capo_workspaces.types.disassociate_account_models_request.DisassociateAccountModelsRequest]",
) -> OperationResponse[
"capo_workspaces.types.disassociate_account_models_result.DisassociateAccountModelsResult"
]:
if req.options.protocol == "awsJson1_1":
import capo_workspaces._operations.workspaces_service.aws_json1_1.disassociate_account_models
output, http_response = (
capo_workspaces._operations.workspaces_service.aws_json1_1.disassociate_account_models.disassociate_account_models(
req.options, req.input
)
)
elif req.options.protocol == "rpcv2Cbor":
import capo_workspaces._operations.workspaces_service.rpcv2_cbor.disassociate_account_models
output, http_response = (
capo_workspaces._operations.workspaces_service.rpcv2_cbor.disassociate_account_models.disassociate_account_models(
req.options, req.input
)
)
else:
raise ValueError(f"unknown protocol {req.options.protocol!r}")
return OperationResponse(output=output, response=http_response)
interceptors_, options_ = self.operation_options(
config_overrides, OperationLogging("DisassociateAccountModels")
)
input_: capo_workspaces.types.disassociate_account_models_request.DisassociateAccountModelsRequest = {
"model_ids": model_ids
}
response = execute_pipeline(
OperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
response.response.close()
return response.output
|