Skip to content

create_faq async

create_faq(
    index_id: IndexId,
    name: FaqName,
    s3_path: S3Path,
    role_arn: RoleArn,
    *,
    config_overrides: Optional[AsynckendraClientConfig] = None,
    description: Optional[Description] = None,
    tags: Optional[TagList] = None,
    file_format: Optional[FaqFileFormat] = None,
    client_token: Optional[ClientTokenName] = None,
    language_code: Optional[LanguageCode] = None,
) -> CreateFaqResponse

Creates a set of frequently ask questions (FAQs) using a specified FAQ file stored in an Amazon S3 bucket.

Adding FAQs to an index is an asynchronous operation.

For an example of adding an FAQ to an index using Python and Java SDKs, see Using your FAQ file.

Parameters:

  • index_id (IndexId) –

    The identifier of the index for the FAQ.

  • name (FaqName) –

    A name for the FAQ.

  • description (Optional[Description], default: None ) –

    A description for the FAQ.

  • s3_path (S3Path) –

    The path to the FAQ file in S3.

  • role_arn (RoleArn) –

    The Amazon Resource Name (ARN) of an IAM role with permission to access the S3 bucket that contains the FAQ file. For more information, see IAM access roles for Amazon Kendra.

  • tags (Optional[TagList], default: None ) –

    A list of key-value pairs that identify the FAQ. You can use the tags to identify and organize your resources and to control access to resources.

  • file_format (Optional[FaqFileFormat], default: None ) –

    The format of the FAQ input file. You can choose between a basic CSV format, a CSV format that includes customs attributes in a header, and a JSON format that includes custom attributes.

    The default format is CSV.

    The format must match the format of the file stored in the S3 bucket identified in the S3Path parameter.

    For more information, see Adding questions and answers.

  • client_token (Optional[ClientTokenName], default: None ) –

    A token that you provide to identify the request to create a FAQ. Multiple calls to the CreateFaqRequest API with the same client token will create only one FAQ.

  • language_code (Optional[LanguageCode], default: None ) –

    The code for a language. This allows you to support a language for the FAQ document. English is supported by default. For more information on supported languages, including their codes, see Adding documents in languages other than English.

Raises:

  • AccessDeniedException –

    You don't have sufficient access to perform this action. Please ensure you have the required permission policies and user accounts and try again.

  • ConflictException –

    A conflict occurred with the request. Please fix any inconsistences with your resources and try again.

  • InternalServerException –

    An issue occurred with the internal server used for your Amazon Kendra service. Please wait a few minutes and try again, or contact Support for help.

  • ResourceNotFoundException –

    The resource you want to use doesn’t exist. Please check you have provided the correct resource and try again.

  • ServiceQuotaExceededException –

    You have exceeded the set limits for your Amazon Kendra service. Please see Quotas for more information, or contact Support to inquire about an increase of limits.

  • ThrottlingException –

    The request was denied due to request throttling. Please reduce the number of requests and try again.

  • ValidationException –

    The input fails to satisfy the constraints set by the Amazon Kendra service. Please provide the correct input and try again.

  • UnknownServiceError –

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

Source code in docs_src/capo_kendra/_services/async_kendra.py
async def create_faq(
    self,
    index_id: "capo_kendra.types.index_id.IndexId",
    name: "capo_kendra.types.faq_name.FaqName",
    s3_path: "capo_kendra.types.s3_path.S3Path",
    role_arn: "capo_kendra.types.role_arn.RoleArn",
    *,
    config_overrides: Optional[AsynckendraClientConfig] = None,
    description: Optional["capo_kendra.types.description.Description"] = None,
    tags: Optional["capo_kendra.types.tag_list.TagList"] = None,
    file_format: Optional["capo_kendra.types.faq_file_format.FaqFileFormat"] = None,
    client_token: Optional[
        "capo_kendra.types.client_token_name.ClientTokenName"
    ] = None,
    language_code: Optional["capo_kendra.types.language_code.LanguageCode"] = None,
) -> "capo_kendra.types.create_faq_response.CreateFaqResponse":
    """<p>Creates a set of frequently ask questions (FAQs) using a specified FAQ file stored in an Amazon S3 bucket.</p> <p>Adding FAQs to an index is an asynchronous operation.</p> <p>For an example of adding an FAQ to an index using Python and Java SDKs, see <a href="https://docs.aws.amazon.com/kendra/latest/dg/in-creating-faq.html#using-faq-file">Using your FAQ file</a>.</p>

    Args:
        index_id: <p>The identifier of the index for the FAQ.</p>
        name: <p>A name for the FAQ.</p>
        description: <p>A description for the FAQ.</p>
        s3_path: <p>The path to the FAQ file in S3.</p>
        role_arn: <p>The Amazon Resource Name (ARN) of an IAM role with permission to access the S3 bucket that contains the FAQ file. For more information, see <a href="https://docs.aws.amazon.com/kendra/latest/dg/iam-roles.html">IAM access roles for Amazon Kendra</a>.</p>
        tags: <p>A list of key-value pairs that identify the FAQ. You can use the tags to identify and organize your resources and to control access to resources.</p>
        file_format: <p>The format of the FAQ input file. You can choose between a basic CSV format, a CSV format that includes customs attributes in a header, and a JSON format that includes custom attributes.</p> <p>The default format is CSV.</p> <p>The format must match the format of the file stored in the S3 bucket identified in the <code>S3Path</code> parameter.</p> <p>For more information, see <a href="https://docs.aws.amazon.com/kendra/latest/dg/in-creating-faq.html">Adding questions and answers</a>.</p>
        client_token: <p>A token that you provide to identify the request to create a FAQ. Multiple calls to the <code>CreateFaqRequest</code> API with the same client token will create only one FAQ. </p>
        language_code: <p>The code for a language. This allows you to support a language for the FAQ document. English is supported by default. For more information on supported languages, including their codes, see <a href="https://docs.aws.amazon.com/kendra/latest/dg/in-adding-languages.html">Adding documents in languages other than English</a>.</p>

    Raises:
        capo_kendra.errors.access_denied_exception.AccessDeniedException: <p>You don't have sufficient access to perform this action. Please ensure you have the required permission policies and user accounts and try again.</p>
        capo_kendra.errors.conflict_exception.ConflictException: <p>A conflict occurred with the request. Please fix any inconsistences with your resources and try again.</p>
        capo_kendra.errors.internal_server_exception.InternalServerException: <p>An issue occurred with the internal server used for your Amazon Kendra service. Please wait a few minutes and try again, or contact <a href="http://aws.amazon.com/contact-us/">Support</a> for help.</p>
        capo_kendra.errors.resource_not_found_exception.ResourceNotFoundException: <p>The resource you want to use doesn’t exist. Please check you have provided the correct resource and try again.</p>
        capo_kendra.errors.service_quota_exceeded_exception.ServiceQuotaExceededException: <p>You have exceeded the set limits for your Amazon Kendra service. Please see <a href="https://docs.aws.amazon.com/kendra/latest/dg/quotas.html">Quotas</a> for more information, or contact <a href="http://aws.amazon.com/contact-us/">Support</a> to inquire about an increase of limits.</p>
        capo_kendra.errors.throttling_exception.ThrottlingException: <p>The request was denied due to request throttling. Please reduce the number of requests and try again.</p>
        capo_kendra.errors.validation_exception.ValidationException: <p>The input fails to satisfy the constraints set by the Amazon Kendra service. Please provide the correct input and try again.</p>
        capo_kendra.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_kendra.types.create_faq_request.CreateFaqRequest]",
    ) -> AsyncOperationResponse[
        "capo_kendra.types.create_faq_response.CreateFaqResponse"
    ]:
        import capo_kendra._operations.aws_kendra_frontend_service.create_faq

        (
            output,
            http_response,
        ) = await capo_kendra._operations.aws_kendra_frontend_service.create_faq.async_create_faq(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateFaq")
    )
    input_: capo_kendra.types.create_faq_request.CreateFaqRequest = {
        "index_id": index_id,
        "name": name,
        "s3_path": s3_path,
        "role_arn": role_arn,
    }
    if description is not None:
        input_["description"] = description
    if tags is not None:
        input_["tags"] = tags
    if file_format is not None:
        input_["file_format"] = file_format
    if client_token is None:
        client_token = str(uuid.uuid4())
    input_["client_token"] = client_token
    if language_code is not None:
        input_["language_code"] = language_code

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