Skip to content

list_foundation_models async

list_foundation_models(
    *,
    config_overrides: Optional[AsyncBedrockClientConfig] = None,
    by_provider: Optional[Provider] = None,
    by_customization_type: Optional[ModelCustomization] = None,
    by_output_modality: Optional[ModelModality] = None,
    by_inference_type: Optional[InferenceType] = None,
    project_identifier: Optional[ProjectIdentifier] = None,
) -> ListFoundationModelsResponse

Lists Amazon Bedrock foundation models that you can use. You can filter the results with the request parameters. For more information, see Foundation models in the Amazon Bedrock User Guide.

Parameters:

  • by_provider (Optional[Provider], default: None ) –

    Return models belonging to the model provider that you specify.

  • by_customization_type (Optional[ModelCustomization], default: None ) –

    Return models that support the customization type that you specify. For more information, see Custom models in the Amazon Bedrock User Guide.

  • by_output_modality (Optional[ModelModality], default: None ) –

    Return models that support the output modality that you specify.

  • by_inference_type (Optional[InferenceType], default: None ) –

    Return models that support the inference type that you specify. For more information, see Provisioned Throughput in the Amazon Bedrock User Guide.

  • project_identifier (Optional[ProjectIdentifier], default: None ) –

    The ID or Amazon Resource Name (ARN) of a project. Amazon Bedrock uses the project's trusted access program participation when determining which models to return. The project must belong to your account in the same AWS Region and partition as the request.

    If you omit this parameter or specify default, Amazon Bedrock uses your account's participation, including organization inheritance. A project that doesn't exist or is archived causes a ValidationException.

Raises:

Source code in docs_src/capo_bedrock/_services/async_bedrock.py
async def list_foundation_models(
    self,
    *,
    config_overrides: Optional[AsyncBedrockClientConfig] = None,
    by_provider: Optional["capo_bedrock.types.provider.Provider"] = None,
    by_customization_type: Optional[
        "capo_bedrock.types.model_customization.ModelCustomization"
    ] = None,
    by_output_modality: Optional[
        "capo_bedrock.types.model_modality.ModelModality"
    ] = None,
    by_inference_type: Optional[
        "capo_bedrock.types.inference_type.InferenceType"
    ] = None,
    project_identifier: Optional[
        "capo_bedrock.types.project_identifier.ProjectIdentifier"
    ] = None,
) -> "capo_bedrock.types.list_foundation_models_response.ListFoundationModelsResponse":
    """<p>Lists Amazon Bedrock foundation models that you can use. You can filter the results with the request parameters. For more information, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/foundation-models.html">Foundation models</a> in the <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/what-is-service.html">Amazon Bedrock User Guide</a>.</p>

    Args:
        by_provider: <p>Return models belonging to the model provider that you specify.</p>
        by_customization_type: <p>Return models that support the customization type that you specify. For more information, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/custom-models.html">Custom models</a> in the <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/what-is-service.html">Amazon Bedrock User Guide</a>.</p>
        by_output_modality: <p>Return models that support the output modality that you specify.</p>
        by_inference_type: <p>Return models that support the inference type that you specify. For more information, see <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/prov-throughput.html">Provisioned Throughput</a> in the <a href="https://docs.aws.amazon.com/bedrock/latest/userguide/what-is-service.html">Amazon Bedrock User Guide</a>.</p>
        project_identifier: <p>The ID or Amazon Resource Name (ARN) of a project. Amazon Bedrock uses the project's trusted access program participation when determining which models to return. The project must belong to your account in the same AWS Region and partition as the request.</p> <p>If you omit this parameter or specify <code>default</code>, Amazon Bedrock uses your account's participation, including organization inheritance. A project that doesn't exist or is archived causes a <code>ValidationException</code>.</p>

    Raises:
        capo_bedrock.errors.access_denied_exception.AccessDeniedException: <p>The request is denied because of missing access permissions.</p>
        capo_bedrock.errors.internal_server_exception.InternalServerException: <p>An internal server error occurred. Retry your request.</p>
        capo_bedrock.errors.throttling_exception.ThrottlingException: <p>The number of requests exceeds the limit. Resubmit your request later.</p>
        capo_bedrock.errors.validation_exception.ValidationException: <p>Input validation failed. Check your request parameters and retry the request.</p>
        capo_bedrock.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_bedrock.types.list_foundation_models_request.ListFoundationModelsRequest]",
    ) -> AsyncOperationResponse[
        "capo_bedrock.types.list_foundation_models_response.ListFoundationModelsResponse"
    ]:
        import capo_bedrock._operations.amazon_bedrock_control_plane_service.list_foundation_models

        (
            output,
            http_response,
        ) = await capo_bedrock._operations.amazon_bedrock_control_plane_service.list_foundation_models.async_list_foundation_models(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("ListFoundationModels")
    )
    input_: capo_bedrock.types.list_foundation_models_request.ListFoundationModelsRequest = {}
    if by_provider is not None:
        input_["by_provider"] = by_provider
    if by_customization_type is not None:
        input_["by_customization_type"] = by_customization_type
    if by_output_modality is not None:
        input_["by_output_modality"] = by_output_modality
    if by_inference_type is not None:
        input_["by_inference_type"] = by_inference_type
    if project_identifier is not None:
        input_["project_identifier"] = project_identifier

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output