Skip to content

list_models async

list_models(
    assistant_id: UuidOrArn,
    *,
    config_overrides: Optional[AsyncQConnectClientConfig] = None,
    ai_prompt_type: Optional[AIPromptType] = None,
    model_lifecycle: Optional[ModelLifecycle] = None,
    next_token: Optional[NextToken] = None,
    max_results: Optional[MaxResults] = None,
) -> ListModelsResponse

Lists the models available to an Amazon Q in Connect assistant in the assistant's Amazon Web Services Region. The available models are determined by the region of the specified assistant.

Parameters:

  • assistant_id (UuidOrArn) –

    The identifier of the Amazon Q in Connect assistant. Can be either the ID or the ARN. URLs cannot contain the ARN. The assistant's region determines which models are available.

  • ai_prompt_type (Optional[AIPromptType], default: None ) –

    The type of the AI Prompt to filter models by. When specified, only models that support the given AI Prompt type are returned.

  • model_lifecycle (Optional[ModelLifecycle], default: None ) –

    The lifecycle status of models to filter by. When specified, only models with the given lifecycle status are returned.

  • next_token (Optional[NextToken], default: None ) –

    The token for the next set of results. Use the value returned in the previous response in the next request to retrieve the next set of results.

  • max_results (Optional[MaxResults], default: None ) –

    The maximum number of results to return per page.

Raises:

  • AccessDeniedException –

    You do not have sufficient access to perform this action.

  • ConflictException –

    The request could not be processed because of conflict in the current state of the resource. For example, if you're using a Create API (such as CreateAssistant) that accepts name, a conflicting resource (usually with the same name) is being created or mutated.

  • ResourceNotFoundException –

    The specified resource does not exist.

  • ThrottlingException –

    The throttling limit has been exceeded.

  • UnauthorizedException –

    You do not have permission to perform this action.

  • ValidationException –

    The input fails to satisfy the constraints specified by a service.

  • UnknownServiceError –

    The service returned an error code this client does not model.

Source code in docs_src/capo_qconnect/_services/async_q_connect.py
async def list_models(
    self,
    assistant_id: "capo_qconnect.types.uuid_or_arn.UuidOrArn",
    *,
    config_overrides: Optional[AsyncQConnectClientConfig] = None,
    ai_prompt_type: Optional[
        "capo_qconnect.types.ai_prompt_type.AIPromptType"
    ] = None,
    model_lifecycle: Optional[
        "capo_qconnect.types.model_lifecycle.ModelLifecycle"
    ] = None,
    next_token: Optional["capo_qconnect.types.next_token.NextToken"] = None,
    max_results: Optional["capo_qconnect.types.max_results.MaxResults"] = None,
) -> "capo_qconnect.types.list_models_response.ListModelsResponse":
    """<p>Lists the models available to an Amazon Q in Connect assistant in the assistant's Amazon Web Services Region. The available models are determined by the region of the specified assistant.</p>

    Args:
        assistant_id: <p>The identifier of the Amazon Q in Connect assistant. Can be either the ID or the ARN. URLs cannot contain the ARN. The assistant's region determines which models are available.</p>
        ai_prompt_type: <p>The type of the AI Prompt to filter models by. When specified, only models that support the given AI Prompt type are returned.</p>
        model_lifecycle: <p>The lifecycle status of models to filter by. When specified, only models with the given lifecycle status are returned.</p>
        next_token: <p>The token for the next set of results. Use the value returned in the previous response in the next request to retrieve the next set of results.</p>
        max_results: <p>The maximum number of results to return per page.</p>

    Raises:
        capo_qconnect.errors.access_denied_exception.AccessDeniedException: <p>You do not have sufficient access to perform this action.</p>
        capo_qconnect.errors.conflict_exception.ConflictException: <p>The request could not be processed because of conflict in the current state of the resource. For example, if you're using a <code>Create</code> API (such as <code>CreateAssistant</code>) that accepts name, a conflicting resource (usually with the same name) is being created or mutated.</p>
        capo_qconnect.errors.resource_not_found_exception.ResourceNotFoundException: <p>The specified resource does not exist.</p>
        capo_qconnect.errors.throttling_exception.ThrottlingException: <p>The throttling limit has been exceeded.</p>
        capo_qconnect.errors.unauthorized_exception.UnauthorizedException: <p>You do not have permission to perform this action.</p>
        capo_qconnect.errors.validation_exception.ValidationException: <p>The input fails to satisfy the constraints specified by a service.</p>
        capo_qconnect.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_qconnect.types.list_models_request.ListModelsRequest]",
    ) -> AsyncOperationResponse[
        "capo_qconnect.types.list_models_response.ListModelsResponse"
    ]:
        import capo_qconnect._operations.wisdom_service.list_models

        (
            output,
            http_response,
        ) = await capo_qconnect._operations.wisdom_service.list_models.async_list_models(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("ListModels")
    )
    input_: capo_qconnect.types.list_models_request.ListModelsRequest = {
        "assistant_id": assistant_id
    }
    if ai_prompt_type is not None:
        input_["ai_prompt_type"] = ai_prompt_type
    if model_lifecycle is not None:
        input_["model_lifecycle"] = model_lifecycle
    if next_token is not None:
        input_["next_token"] = next_token
    if max_results is not None:
        input_["max_results"] = max_results

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