Skip to content

update_ai_prompt

update_ai_prompt(
    assistant_id: UuidOrArn,
    ai_prompt_id: UuidOrArnOrEitherWithQualifier,
    visibility_status: VisibilityStatus,
    *,
    config_overrides: Optional[QConnectClientConfig] = None,
    client_token: Optional[ClientToken] = None,
    template_configuration: Optional[AIPromptTemplateConfiguration] = None,
    description: Optional[Description] = None,
    model_id: Optional[AIPromptModelIdentifier] = None,
    inference_configuration: Optional[AIPromptInferenceConfiguration] = None,
) -> UpdateAIPromptResponse

Updates an AI Prompt.

Parameters:

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/q_connect.py
def update_ai_prompt(
    self,
    assistant_id: "capo_qconnect.types.uuid_or_arn.UuidOrArn",
    ai_prompt_id: "capo_qconnect.types.uuid_or_arn_or_either_with_qualifier.UuidOrArnOrEitherWithQualifier",
    visibility_status: "capo_qconnect.types.visibility_status.VisibilityStatus",
    *,
    config_overrides: Optional[QConnectClientConfig] = None,
    client_token: Optional["capo_qconnect.types.client_token.ClientToken"] = None,
    template_configuration: Optional[
        "capo_qconnect.types.ai_prompt_template_configuration.AIPromptTemplateConfiguration"
    ] = None,
    description: Optional["capo_qconnect.types.description.Description"] = None,
    model_id: Optional[
        "capo_qconnect.types.ai_prompt_model_identifier.AIPromptModelIdentifier"
    ] = None,
    inference_configuration: Optional[
        "capo_qconnect.types.ai_prompt_inference_configuration.AIPromptInferenceConfiguration"
    ] = None,
) -> "capo_qconnect.types.update_ai_prompt_response.UpdateAIPromptResponse":
    """<p>Updates an AI Prompt.</p>

    Args:
        client_token: <p>A unique, case-sensitive identifier that you provide to ensure the idempotency of the request. If not provided, the Amazon Web Services SDK populates this field. For more information about idempotency, see <a href="http://aws.amazon.com/builders-library/making-retries-safe-with-idempotent-APIs/">Making retries safe with idempotent APIs</a>..</p>
        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.</p>
        ai_prompt_id: <p>The identifier of the Amazon Q in Connect AI Prompt.</p>
        visibility_status: <p>The visibility status of the Amazon Q in Connect AI prompt.</p>
        template_configuration: <p>The configuration of the prompt template for this AI Prompt.</p>
        description: <p>The description of the Amazon Q in Connect AI Prompt.</p>
        model_id: <p>The identifier of the model used for this AI Prompt.</p> <note> <p>For information about which models are supported in each Amazon Web Services Region, see <a href="https://docs.aws.amazon.com/connect/latest/adminguide/create-ai-prompts.html#cli-create-aiprompt">Supported models for system/custom prompts</a>.</p> </note>
        inference_configuration: <p>The updated inference configuration for the AI Prompt.</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.
    """

    def _handler(
        req: "OperationRequest[capo_qconnect.types.update_ai_prompt_request.UpdateAIPromptRequest]",
    ) -> OperationResponse[
        "capo_qconnect.types.update_ai_prompt_response.UpdateAIPromptResponse"
    ]:
        import capo_qconnect._operations.wisdom_service.update_ai_prompt

        output, http_response = (
            capo_qconnect._operations.wisdom_service.update_ai_prompt.update_ai_prompt(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

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

        return capo_qconnect.types.update_ai_prompt_request.redact_sensitive(input_)

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

        return capo_qconnect.types.update_ai_prompt_response.redact_sensitive(
            output
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging(
            "UpdateAIPrompt",
            redact_input=_redact_input,
            redact_output=_redact_output,
        ),
    )
    input_: capo_qconnect.types.update_ai_prompt_request.UpdateAIPromptRequest = {
        "assistant_id": assistant_id,
        "ai_prompt_id": ai_prompt_id,
        "visibility_status": visibility_status,
    }
    if client_token is None:
        client_token = str(uuid.uuid4())
    input_["client_token"] = client_token
    if template_configuration is not None:
        input_["template_configuration"] = template_configuration
    if description is not None:
        input_["description"] = description
    if model_id is not None:
        input_["model_id"] = model_id
    if inference_configuration is not None:
        input_["inference_configuration"] = inference_configuration

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output