Skip to content

retrieve async

retrieve(
    assistant_id: UuidOrArn,
    retrieval_configuration: RetrievalConfiguration,
    retrieval_query: NonEmptySensitiveString,
    *,
    config_overrides: Optional[AsyncQConnectClientConfig] = None,
) -> RetrieveResponse

Retrieves content from knowledge sources based on a query.

Parameters:

  • assistant_id (UuidOrArn) –

    The identifier of the Amazon Q in Connect assistant for content retrieval.

  • retrieval_configuration (RetrievalConfiguration) –

    The configuration for the content retrieval operation.

  • retrieval_query (NonEmptySensitiveString) –

    The query for content retrieval.

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.

  • DependencyFailedException –

    The request failed because it depends on another request that failed.

  • RequestTimeoutException –

    The request reached the service more than 15 minutes after the date stamp on the request or more than 15 minutes after the request expiration date (such as for pre-signed URLs), or the date stamp on the request is more than 15 minutes in the future.

  • ResourceNotFoundException –

    The specified resource does not exist.

  • ServiceQuotaExceededException –

    You've exceeded your service quota. To perform the requested action, remove some of the relevant resources, or use service quotas to request a service quota increase.

  • ThrottlingException –

    The throttling limit has been exceeded.

  • 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 retrieve(
    self,
    assistant_id: "capo_qconnect.types.uuid_or_arn.UuidOrArn",
    retrieval_configuration: "capo_qconnect.types.retrieval_configuration.RetrievalConfiguration",
    retrieval_query: "capo_qconnect.types.non_empty_sensitive_string.NonEmptySensitiveString",
    *,
    config_overrides: Optional[AsyncQConnectClientConfig] = None,
) -> "capo_qconnect.types.retrieve_response.RetrieveResponse":
    """<p>Retrieves content from knowledge sources based on a query.</p>

    Args:
        assistant_id: <p>The identifier of the Amazon Q in Connect assistant for content retrieval.</p>
        retrieval_configuration: <p>The configuration for the content retrieval operation.</p>
        retrieval_query: <p>The query for content retrieval.</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.dependency_failed_exception.DependencyFailedException: <p>The request failed because it depends on another request that failed.</p>
        capo_qconnect.errors.request_timeout_exception.RequestTimeoutException: <p>The request reached the service more than 15 minutes after the date stamp on the request or more than 15 minutes after the request expiration date (such as for pre-signed URLs), or the date stamp on the request is more than 15 minutes in the future.</p>
        capo_qconnect.errors.resource_not_found_exception.ResourceNotFoundException: <p>The specified resource does not exist.</p>
        capo_qconnect.errors.service_quota_exceeded_exception.ServiceQuotaExceededException: <p>You've exceeded your service quota. To perform the requested action, remove some of the relevant resources, or use service quotas to request a service quota increase.</p>
        capo_qconnect.errors.throttling_exception.ThrottlingException: <p>The throttling limit has been exceeded.</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.retrieve_request.RetrieveRequest]",
    ) -> AsyncOperationResponse[
        "capo_qconnect.types.retrieve_response.RetrieveResponse"
    ]:
        import capo_qconnect._operations.wisdom_service.retrieve

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

    def _redact_input(
        input_: "capo_qconnect.types.retrieve_request.RetrieveRequest",
    ) -> dict[str, Any]:
        import capo_qconnect.types.retrieve_request

        return capo_qconnect.types.retrieve_request.redact_sensitive(input_)

    def _redact_output(
        output: "capo_qconnect.types.retrieve_response.RetrieveResponse",
    ) -> dict[str, Any]:
        import capo_qconnect.types.retrieve_response

        return capo_qconnect.types.retrieve_response.redact_sensitive(output)

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging(
            "Retrieve", redact_input=_redact_input, redact_output=_redact_output
        ),
    )
    input_: capo_qconnect.types.retrieve_request.RetrieveRequest = {
        "assistant_id": assistant_id,
        "retrieval_configuration": retrieval_configuration,
        "retrieval_query": retrieval_query,
    }

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