Skip to content

update_retrieval_instruction async

update_retrieval_instruction(
    retrieval_instruction_id: RetrievalInstructionId,
    instruction: RetrievalInstructionContent,
    *,
    config_overrides: Optional[AsyncBedrockAgentClientConfig] = None,
    description: Optional[RetrievalInstructionDescription] = None,
) -> UpdateRetrievalInstructionResponse

Updates the content of a retrieval instruction. The update is processed asynchronously; the stored content is a candidate until content review passes, and the served content does not change while the update is in flight. The service rejects the request with ConflictException while lastTransitionStatus is CREATING or UPDATING.

Parameters:

  • retrieval_instruction_id (RetrievalInstructionId) –

    The identifier of the retrieval instruction to update.

  • instruction (RetrievalInstructionContent) –

    The replacement instruction content. This is a full replacement of all four fields, not a patch. During UPDATING, Get continues to return the previously-served content until the update review passes.

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

    A replacement description; applied together with the content when the review passes. Omit to clear.

Raises:

Source code in docs_src/capo_bedrock_agent/_services/async_bedrock_agent.py
async def update_retrieval_instruction(
    self,
    retrieval_instruction_id: "capo_bedrock_agent.types.retrieval_instruction_id.RetrievalInstructionId",
    instruction: "capo_bedrock_agent.types.retrieval_instruction_content.RetrievalInstructionContent",
    *,
    config_overrides: Optional[AsyncBedrockAgentClientConfig] = None,
    description: Optional[
        "capo_bedrock_agent.types.retrieval_instruction_description.RetrievalInstructionDescription"
    ] = None,
) -> "capo_bedrock_agent.types.update_retrieval_instruction_response.UpdateRetrievalInstructionResponse":
    """<p>Updates the content of a retrieval instruction. The update is processed asynchronously; the stored content is a candidate until content review passes, and the served content does not change while the update is in flight. The service rejects the request with ConflictException while lastTransitionStatus is CREATING or UPDATING.</p>

    Args:
        retrieval_instruction_id: <p>The identifier of the retrieval instruction to update.</p>
        instruction: <p>The replacement instruction content. This is a full replacement of all four fields, not a patch. During UPDATING, Get continues to return the previously-served content until the update review passes.</p>
        description: <p>A replacement description; applied together with the content when the review passes. Omit to clear.</p>

    Raises:
        capo_bedrock_agent.errors.access_denied_exception.AccessDeniedException: <p>The request is denied because of missing access permissions.</p>
        capo_bedrock_agent.errors.conflict_exception.ConflictException: <p>There was a conflict performing an operation.</p>
        capo_bedrock_agent.errors.internal_server_exception.InternalServerException: <p>An internal server error occurred. Retry your request.</p>
        capo_bedrock_agent.errors.resource_not_found_exception.ResourceNotFoundException: <p>The specified resource Amazon Resource Name (ARN) was not found. Check the Amazon Resource Name (ARN) and try your request again.</p>
        capo_bedrock_agent.errors.throttling_exception.ThrottlingException: <p>The number of requests exceeds the limit. Resubmit your request later.</p>
        capo_bedrock_agent.errors.validation_exception.ValidationException: <p>Input validation failed. Check your request parameters and retry the request.</p>
        capo_bedrock_agent.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_bedrock_agent.types.update_retrieval_instruction_request.UpdateRetrievalInstructionRequest]",
    ) -> AsyncOperationResponse[
        "capo_bedrock_agent.types.update_retrieval_instruction_response.UpdateRetrievalInstructionResponse"
    ]:
        import capo_bedrock_agent._operations.amazon_bedrock_agent_build_time_lambda.update_retrieval_instruction

        (
            output,
            http_response,
        ) = await capo_bedrock_agent._operations.amazon_bedrock_agent_build_time_lambda.update_retrieval_instruction.async_update_retrieval_instruction(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    def _redact_input(
        input_: "capo_bedrock_agent.types.update_retrieval_instruction_request.UpdateRetrievalInstructionRequest",
    ) -> dict[str, Any]:
        import capo_bedrock_agent.types.update_retrieval_instruction_request

        return capo_bedrock_agent.types.update_retrieval_instruction_request.redact_sensitive(
            input_
        )

    def _redact_output(
        output: "capo_bedrock_agent.types.update_retrieval_instruction_response.UpdateRetrievalInstructionResponse",
    ) -> dict[str, Any]:
        import capo_bedrock_agent.types.update_retrieval_instruction_response

        return capo_bedrock_agent.types.update_retrieval_instruction_response.redact_sensitive(
            output
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging(
            "UpdateRetrievalInstruction",
            redact_input=_redact_input,
            redact_output=_redact_output,
        ),
    )
    input_: capo_bedrock_agent.types.update_retrieval_instruction_request.UpdateRetrievalInstructionRequest = {
        "retrieval_instruction_id": retrieval_instruction_id,
        "instruction": instruction,
    }
    if description is not None:
        input_["description"] = description

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